コード例 #1
0
 def setUp(self):
     super(NexusVxlanTypeTest, self).setUp()
     self.driver = type_nexus_vxlan.NexusVxlanTypeDriver()
     self.driver.conf_mcast_ranges = MCAST_GROUP_RANGES
     self.driver.tunnel_ranges = VNI_RANGES
     self.driver.sync_allocations()
     self.context = bc.get_db_ref(bc.get_context())
コード例 #2
0
    def update_subports(self, port):
        """Set port attributes for trunk subports.

        For baremetal deployments only, set the neutron port attributes
        during the bind_port event.
        """
        trunk_details = port.get('trunk_details')
        subports = trunk_details['sub_ports']

        host_id = port.get(bc.dns.DNSNAME)
        context = bc.get_context()
        el_context = context.elevated()

        for subport in subports:
            bc.get_plugin().update_port(
                el_context, subport['port_id'], {
                    'port': {
                        bc.portbindings.HOST_ID: host_id,
                        'device_owner': bc.trunk_consts.TRUNK_SUBPORT_OWNER
                    }
                })

        # Set trunk to ACTIVE status.
        trunk_obj = bc.trunk_objects.Trunk.get_object(
            el_context, id=trunk_details['trunk_id'])
        trunk_obj.update(status=bc.trunk_consts.ACTIVE_STATUS)
コード例 #3
0
ファイル: trunk.py プロジェクト: mezcua/networking-cisco
    def is_trunk_subport_baremetal(self, port):
        context = bc.get_context()
        el_context = context.elevated()

        subport_obj = bc.trunk_objects.SubPort.get_object(
            el_context, port_id=port['id'])
        if subport_obj:
            trunk_obj = bc.trunk_objects.Trunk.get_object(
                el_context, id=subport_obj.trunk_id)
            trunk_port = bc.get_plugin().get_port(
                el_context, trunk_obj.port_id)
            return nexus_help.is_baremetal(trunk_port)
        else:
            return False
コード例 #4
0
        def new_nexus_init(mech_instance):
            mech_instance.driver = mech_instance._load_nexus_cfg_driver()
            mech_instance.monitor_timeout = (
                cfg.CONF.ml2_cisco.switch_heartbeat_time)
            mech_instance._ppid = os.getpid()

            mech_instance._switch_state = {}
            mech_instance._nexus_switches = collections.OrderedDict()
            for name, config in self.test_configs.items():
                ip_addr = config.nexus_ip_addr
                host_name = config.host_name
                nexus_ports = config.nexus_port
                # baremetal config done differently
                if not ip_addr:
                    continue
                # if VNIC_TYPE is baremetal
                # VMs that reference this baremetal
                # do not configure an entry in the host mapping db
                # since code learns this information.
                if (host_name is not HOST_NAME_UNUSED
                        and HOST_NAME_Baremetal not in host_name):
                    for nexus_port in nexus_ports.split(','):
                        try:
                            nexus_db_v2.get_switch_if_host_mappings(
                                ip_addr, nexus_port)
                        except exceptions.NexusHostMappingNotFound:
                            nexus_db_v2.add_host_mapping(
                                host_name, ip_addr, nexus_port, 0, True)
                mech_instance._nexus_switches[(ip_addr,
                                               'ssh_port')] = NEXUS_SSH_PORT
                mech_instance._nexus_switches[(ip_addr,
                                               constants.USERNAME)] = 'admin'
                mech_instance._nexus_switches[(
                    ip_addr, constants.PASSWORD)] = 'password'
                mech_instance._nexus_switches[(ip_addr,
                                               const.PHYSNET)] = PHYSNET
            mech_instance.driver.nexus_switches = (
                mech_instance._nexus_switches)
            mech_instance.context = bc.get_context()
コード例 #5
0
        def new_nexus_init(mech_instance):
            mech_instance.driver = mech_instance._load_nexus_cfg_driver()
            mech_instance.monitor_timeout = (
                cfg.CONF.ml2_cisco.switch_heartbeat_time)
            mech_instance._ppid = os.getpid()

            mech_instance._switch_state = {}
            mech_instance._nexus_switches = collections.OrderedDict()
            for name, config in self.test_configs.items():
                ip_addr = config.nexus_ip_addr
                host_name = config.host_name
                nexus_port = config.nexus_port
                # baremetal config done differently
                if not ip_addr:
                    continue
                if host_name is not HOST_NAME_UNUSED:
                    if (ip_addr, host_name) in mech_instance._nexus_switches:
                        saved_port = (mech_instance._nexus_switches[
                            (ip_addr, host_name)])
                        if saved_port != nexus_port:
                            mech_instance._nexus_switches[
                                (ip_addr, host_name)] = (
                                    saved_port + ',' + nexus_port)
                    else:
                        mech_instance._nexus_switches[
                            (ip_addr, host_name)] = nexus_port
                mech_instance._nexus_switches[(ip_addr,
                                               'ssh_port')] = NEXUS_SSH_PORT
                mech_instance._nexus_switches[(ip_addr,
                                               constants.USERNAME)] = 'admin'
                mech_instance._nexus_switches[(ip_addr,
                                              constants.PASSWORD)] = 'password'
                mech_instance._nexus_switches[(ip_addr,
                                              'physnet')] = PHYSNET
            mech_instance.driver.nexus_switches = (
                mech_instance._nexus_switches)
            mech_instance.context = bc.get_context()