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=2bf0b52f839890f7602c4986365c883439eea3ae;hp=1c5b5285e2fcbc17581db02fcac333ffd88de3bf;hb=c047048a86c3ad82c3f31c9aa5e0eacb47f9caf3;hpb=09d18d36e102945621e91855898eb79dbd312809 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 1c5b5285..2bf0b52f 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 @@ -39,7 +39,7 @@ class UnderlayApi: url = url + "/" self.url = url - auth_url = None + self.auth_url = None self.project = None self.domain = None self.asn = None @@ -56,10 +56,13 @@ class UnderlayApi: if user: self.user = user - if password: self.password = password + 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)) + auth_dict = {} auth_dict['auth'] = {} auth_dict['auth']['scope'] = {} @@ -130,6 +133,19 @@ class UnderlayApi: else: return None + def delete_ref(self, type, uuid, ref_type, ref_uuid, ref_fq_name): + payload = { + "type": type, + "uuid": uuid, + "ref-type": ref_type, + "ref-fq-name": ref_fq_name, + "operation": "DELETE" + } + endpoint = self.controller_url + "ref-update" + 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): @@ -303,3 +319,6 @@ class UnderlayApi: self.delete_by_uuid(self.controller_url, 'virtual-machine-interface', uuid) self.logger.debug("deleted vmi: {}".format(uuid)) + 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) +