1 # -------------------------------------------------------------------------
2 # Copyright (c) 2018 Huawei Intellectual Property
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # -------------------------------------------------------------------------
20 from requests.auth import HTTPBasicAuth
26 This values will need to deleted..
27 only added for the debug purpose
29 aai_host = "https:\\192.168.17.26:8443"
31 "X-TransactionId": "9999",
33 "Content-Type": "applicatoin/json",
38 def getRoute(self, request):
45 print(request["srcPort"])
46 print(request["dstport"])
47 src_access_node_id = request["srcPort"]["src-access-node-id"]
48 dst_access_node_id = request["dstPort"]["dst-access-node-id"]
50 ingress_p_interface = None
51 egress_p_interface = None
53 logical_links = self.get_logical_links()
56 TODO: Logic to be extended for the repose filling
60 def get_logical_links(self):
62 This method returns list of all cross ONAP links
63 from /aai/v14/network/logical-links?operation-status="Up"
64 :return: logical-links[]
66 logical_link_url = "/aai/v14/network/logical-links?operation-status=\"Up\""
67 aai_req_url = self.aai_host + logical_link_url
69 response = requests.get(aai_req_url,
70 headers=self.aai_headers,
71 auth=HTTPBasicAuth("", ""))
73 if response.status_code == 200: