X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=blobdiff_plain;f=RO-SDN-juniper_contrail%2Fosm_rosdn_juniper_contrail%2Fsdn_api.py;h=6ef91af2709409b20729908065f0edd62003a60c;hp=2bf0b52f839890f7602c4986365c883439eea3ae;hb=d60bdd09bf04c8e7add7c7bfe2cfd0d74113db40;hpb=d0f7e798d3462027dc2c8d612a89600f4a6bad3e diff --git a/RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/sdn_api.py b/RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/sdn_api.py index 2bf0b52f..6ef91af2 100644 --- a/RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/sdn_api.py +++ b/RO-SDN-juniper_contrail/osm_rosdn_juniper_contrail/sdn_api.py @@ -17,11 +17,12 @@ import logging import json -from osm_ro.wim.sdnconn import SdnConnectorError +from osm_ro_plugin.sdnconn import SdnConnectorError from osm_rosdn_juniper_contrail.rest_lib import ContrailHttp from osm_rosdn_juniper_contrail.rest_lib import NotFound -from osm_rosdn_juniper_contrail.rest_lib import DuplicateFound -from osm_rosdn_juniper_contrail.rest_lib import HttpException +# from osm_rosdn_juniper_contrail.rest_lib import DuplicateFound +# from osm_rosdn_juniper_contrail.rest_lib import HttpException + class UnderlayApi: """ Class with CRUD operations for the underlay API """ @@ -61,7 +62,7 @@ class UnderlayApi: self.logger.debug("Config parameters for the underlay controller: auth_url: {}, project: {}," " domain: {}, user: {}, password: {}".format(self.auth_url, self.project, - self.domain, self.user, self.password)) + self.domain, self.user, self.password)) auth_dict = {} auth_dict['auth'] = {} @@ -142,17 +143,15 @@ class UnderlayApi: "operation": "DELETE" } endpoint = self.controller_url + "ref-update" - resp = self.http.post_cmd(url=endpoint, - headers=self.http_header, - post_fields_dict=payload) + resp = self.http.post_cmd(url=endpoint, headers=self.http_header, post_fields_dict=payload) return resp # Aux methods to avoid code duplication of name conventions def get_vpg_name(self, switch_id, switch_port): - return "{}_{}".format(switch_id, switch_port) + return "{}_{}".format(switch_id, switch_port).replace(":","_") def get_vmi_name(self, switch_id, switch_port, vlan): - return "{}_{}-{}".format(switch_id, switch_port, vlan) + return "{}_{}-{}".format(switch_id, switch_port, vlan).replace(":","_") # Virtual network operations @@ -230,11 +229,10 @@ class UnderlayApi: return self.get_by_uuid(self.controller_url, "virtual-port-group", vpg_id) def get_vpg_by_name(self, vpg_name): - fq_name = [ - "default-global-system-config", - self.fabric, - vpg_name - ] + fq_name = ["default-global-system-config", + self.fabric, + vpg_name + ] return self.get_by_fq_name("virtual-port-group", fq_name) def delete_vpg(self, vpg_id): @@ -321,4 +319,3 @@ class UnderlayApi: def unref_vmi_vpg(self, vpg_id, vmi_id, vmi_fq_name): self.delete_ref("virtual-port-group", vpg_id, "virtual-machine-interface", vmi_id, vmi_fq_name) -