コード例 #1
0
ファイル: mech_cisco_nexus.py プロジェクト: zip-code/neutron
    def initialize(self):
        # Create ML2 device dictionary from ml2_conf.ini entries.
        conf.ML2MechCiscoConfig()

        # Extract configuration parameters from the configuration file.
        self._nexus_switches = conf.ML2MechCiscoConfig.nexus_dict
        LOG.debug("nexus_switches found = %s", self._nexus_switches)

        self.driver = nexus_network_driver.CiscoNexusDriver()
コード例 #2
0
    def initialize(self):
        # Create ML2 device dictionary from ml2_conf.ini entries.
        conf.ML2MechCiscoConfig()

        # Extract configuration parameters from the configuration file.
        self._nexus_switches = conf.ML2MechCiscoConfig.nexus_dict
        LOG.debug(_("nexus_switches found = %s"), self._nexus_switches)

        self.credentials = {}
        self.driver = nexus_network_driver.CiscoNexusDriver()

        # Initialize credential store after database initialization.
        cred.Store.initialize()
コード例 #3
0
 def test_create_device_dictionary(self):
     """Test creation of the device dictionary based on nexus config."""
     test_config = {
         'ml2_mech_cisco_nexus:1.1.1.1': {
             'username': ['admin'],
             'password': ['mySecretPassword'],
             'ssh_port': [22],
             'compute1': ['1/1'],
             'compute2': ['1/2'],
             'compute5': ['1/3,1/4']
         },
         'ml2_mech_cisco_nexus:2.2.2.2': {
             'username': ['admin'],
             'password': ['mySecretPassword'],
             'ssh_port': [22],
             'compute3': ['1/1'],
             'compute4': ['1/2'],
             'compute5': ['portchannel:20,portchannel:30']
         },
     }
     expected_dev_dict = {
         ('1.1.1.1', 'username'): 'admin',
         ('1.1.1.1', 'password'): 'mySecretPassword',
         ('1.1.1.1', 'ssh_port'): 22,
         ('1.1.1.1', 'compute1'): '1/1',
         ('1.1.1.1', 'compute2'): '1/2',
         ('1.1.1.1', 'compute5'): '1/3,1/4',
         ('2.2.2.2', 'username'): 'admin',
         ('2.2.2.2', 'password'): 'mySecretPassword',
         ('2.2.2.2', 'ssh_port'): 22,
         ('2.2.2.2', 'compute3'): '1/1',
         ('2.2.2.2', 'compute4'): '1/2',
         ('2.2.2.2', 'compute5'): 'portchannel:20,portchannel:30',
     }
     with mock.patch.object(cfg, 'MultiConfigParser') as parser:
         parser.return_value.read.return_value = cfg.CONF.config_file
         parser.return_value.parsed = [test_config]
         cisco_config.ML2MechCiscoConfig()
         self.assertEqual(expected_dev_dict,
                          cisco_config.ML2MechCiscoConfig.nexus_dict)