def _create_snat_vn(self, proj_obj, si_obj, si_props, vn_fq_name_str, idx):
        # SNAT NetNS use a dedicated network (non shared vn)
        vn_name = '%s_%s' % (svc_info.get_snat_left_network_prefix_name(),
                             si_obj.name)
        vn_fq_name = proj_obj.get_fq_name() + [vn_name]
        try:
            vn_id = self._vnc_lib.fq_name_to_id('virtual-network',
                                                vn_fq_name)
        except NoIdError:
            snat_cidr = svc_info.get_snat_left_subnet()
            vn_id = self._create_svc_vn(vn_name, snat_cidr, proj_obj,
                                        user_visible=False)

        if vn_fq_name_str != ':'.join(vn_fq_name):
            left_if = ServiceInstanceInterfaceType(
                virtual_network=':'.join(vn_fq_name))
            si_props.insert_interface_list(idx, left_if)
            si_obj.set_service_instance_properties(si_props)
            self._vnc_lib.service_instance_update(si_obj)
            self.logger.log("Info: SI %s updated with left vn %s" %
                             (si_obj.get_fq_name_str(), vn_fq_name_str))

        si_entry = {}
        si_entry['left-vn'] = vn_name
        si_entry[vn_name] = vn_id
        self.db.service_instance_insert(si_obj.get_fq_name_str(), si_entry)

        return vn_id
 def _create_snat_vn(self, si_obj, vn_name):
     snat_subnet = svc_info.get_snat_left_subnet()
     self._svc_mon.netns_manager.create_service_vn(vn_name,
                                                   snat_subnet,
                                                   None,
                                                   si_obj.fq_name[:-1],
                                                   user_visible=False)
    def _create_snat_vn(self, si, vn_fq_str, index):
        vn_name = '%s_%s' % (svc_info.get_snat_left_vn_prefix(),
                             si.name)
        vn_fq_name = si.fq_name[:-1] + [vn_name]
        try:
            vn_id = self._vnc_lib.fq_name_to_id(
                'virtual-network', vn_fq_name)
        except NoIdError:
            snat_subnet = svc_info.get_snat_left_subnet()
            vn_id = self.create_service_vn(vn_name, snat_subnet,
                si.fq_name[:-1], user_visible=False)

        if vn_fq_str != ':'.join(vn_fq_name):
            si_obj = ServiceInstance()
            si_obj.uuid = si.uuid
            si_obj.fq_name = si.fq_name
            si_props = ServiceInstanceType(**si.params)
            left_if = ServiceInstanceInterfaceType(
                virtual_network=':'.join(vn_fq_name))
            si_props.insert_interface_list(index, left_if)
            si_obj.set_service_instance_properties(si_props)
            self._vnc_lib.service_instance_update(si_obj)
            self.logger.log_info("SI %s updated with left vn %s" %
                (si_obj.get_fq_name_str(), vn_fq_str))

        return vn_id
Beispiel #4
0
    def _create_snat_vn(self, proj_obj, si_obj, si_props, vn_fq_name_str, idx):
        # SNAT NetNS use a dedicated network (non shared vn)
        vn_name = '%s_%s' % (svc_info.get_snat_left_network_prefix_name(),
                             si_obj.name)
        vn_fq_name = proj_obj.get_fq_name() + [vn_name]
        try:
            vn_id = self._vnc_lib.fq_name_to_id('virtual-network', vn_fq_name)
        except NoIdError:
            snat_cidr = svc_info.get_snat_left_subnet()
            vn_id = self._create_svc_vn(vn_name,
                                        snat_cidr,
                                        proj_obj,
                                        user_visible=False)

        if vn_fq_name_str != ':'.join(vn_fq_name):
            left_if = ServiceInstanceInterfaceType(
                virtual_network=':'.join(vn_fq_name))
            si_props.insert_interface_list(idx, left_if)
            si_obj.set_service_instance_properties(si_props)
            self._vnc_lib.service_instance_update(si_obj)
            self.logger.log("Info: SI %s updated with left vn %s" %
                            (si_obj.get_fq_name_str(), vn_fq_name_str))

        si_entry = {}
        si_entry['left-vn'] = vn_name
        si_entry[vn_name] = vn_id
        self.db.service_instance_insert(si_obj.get_fq_name_str(), si_entry)

        return vn_id
Beispiel #5
0
    def _create_snat_vn(self, si, vn_fq_str, index):
        vn_name = '%s_%s' % (svc_info.get_snat_left_vn_prefix(), si.name)
        vn_fq_name = si.fq_name[:-1] + [vn_name]
        try:
            vn_id = self._vnc_lib.fq_name_to_id('virtual-network', vn_fq_name)
        except NoIdError:
            snat_subnet = svc_info.get_snat_left_subnet()
            vn_id = self.create_service_vn(vn_name,
                                           snat_subnet,
                                           si.fq_name[:-1],
                                           user_visible=False)

        if vn_fq_str != ':'.join(vn_fq_name):
            si_obj = ServiceInstance()
            si_obj.uuid = si.uuid
            si_obj.fq_name = si.fq_name
            si_props = ServiceInstanceType(**si.params)
            left_if = ServiceInstanceInterfaceType(
                virtual_network=':'.join(vn_fq_name))
            si_props.insert_interface_list(index, left_if)
            si_obj.set_service_instance_properties(si_props)
            self._vnc_lib.service_instance_update(si_obj)
            self.logger.log_info("SI %s updated with left vn %s" %
                                 (si_obj.get_fq_name_str(), vn_fq_str))

        return vn_id
    def _create_snat_vn(self, proj_obj, si_obj, si_props, vn_fq_name_str):
        # SNAT NetNS use a dedicated network (non shared vn)
        vn_name = "svc-snat-%s" % si_obj.name
        vn_fq_name = proj_obj.get_fq_name() + [vn_name]
        try:
            vn_id = self._vnc_lib.fq_name_to_id("virtual-network", vn_fq_name)
        except NoIdError:
            snat_cidr = svc_info.get_snat_left_subnet()
            vn_id = self._create_svc_vn(vn_name, snat_cidr, proj_obj)

        if vn_fq_name_str != ":".join(vn_fq_name):
            si_props.set_left_virtual_network(":".join(vn_fq_name))
            si_obj.set_service_instance_properties(si_props)
            self._vnc_lib.service_instance_update(si_obj)
            self.logger.log("Info: SI %s updated with left vn %s" % (si_obj.get_fq_name_str(), vn_fq_name_str))

        return vn_id
Beispiel #7
0
    def _create_snat_vn(self, proj_obj, si_obj, si_props, vn_fq_name_str):
        # SNAT NetNS use a dedicated network (non shared vn)
        vn_name = '%s_%s' % (svc_info.get_snat_left_network_prefix_name(),
                             si_obj.name)
        vn_fq_name = proj_obj.get_fq_name() + [vn_name]
        try:
            vn_id = self._vnc_lib.fq_name_to_id('virtual-network', vn_fq_name)
        except NoIdError:
            snat_cidr = svc_info.get_snat_left_subnet()
            vn_id = self._create_svc_vn(vn_name, snat_cidr, proj_obj)

        if vn_fq_name_str != ':'.join(vn_fq_name):
            si_props.set_left_virtual_network(':'.join(vn_fq_name))
            si_obj.set_service_instance_properties(si_props)
            self._vnc_lib.service_instance_update(si_obj)
            self.logger.log("Info: SI %s updated with left vn %s" %
                            (si_obj.get_fq_name_str(), vn_fq_name_str))

        return vn_id
 def _create_snat_vn(self, si_obj, vn_name):
     snat_subnet = svc_info.get_snat_left_subnet()
     self._svc_mon.netns_manager.create_service_vn(
         vn_name, snat_subnet, si_obj.fq_name[:-1],
         user_visible=False)