How to use the pyeapi.client.config function in pyeapi

To help you get started, we’ve selected a few pyeapi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arista-eosplus / pyeapi / test / lib / systestlib.py View on Github external
def setUp(self):
        pyeapi.client.load_config(filename=get_fixture('dut.conf'))
        config = pyeapi.client.config

        self.duts = list()
        for name in config.sections():
            if name.startswith('connection:') and 'localhost' not in name:
                name = name.split(':')[1]
                self.duts.append(pyeapi.client.connect_to(name))
github arista-eosplus / pyeapi / test / system / test_client.py View on Github external
def setUp(self):
        pyeapi.client.load_config(filename=get_fixture('dut.conf'))
        config = pyeapi.client.config

        self.duts = list()
        for name in config.sections():
            if name.startswith('connection:') and 'localhost' not in name:
                name = name.split(':')[1]
                dut = pyeapi.client.connect_to(name)
                self.duts.append(dut)
                if dut._enablepwd is not None:
                    # If enable password defined for dut, set the
                    # enable password on the dut and clear it on tearDown
                    dut.config("enable secret %s" % dut._enablepwd)
github arista-eosplus / pyeapi / test / unit / test_client.py View on Github external
def test_load_config_for_connection_with_filename(self):
        conf = get_fixture('eapi.conf')
        pyeapi.client.load_config(filename=conf)
        cfg = pyeapi.client.config.get_connection('test1')
        self.assertEqual(cfg['host'], '192.168.1.16')
        self.assertEqual(cfg['username'], 'eapi')
        self.assertEqual(cfg['password'], 'password')
        self.assertEqual(cfg['enablepwd'], 'enablepwd')
github arista-eosplus / pyeapi / test / unit / test_client.py View on Github external
def test_load_config_empty_conf(self):
        conf = get_fixture('empty.conf')
        pyeapi.client.load_config(filename=conf)
        conns = pyeapi.client.config.connections
        self.assertEqual(conns, ['localhost'])
github arista-eosplus / pyeapi / test / unit / test_client.py View on Github external
def test_load_config_env_path(self):
        os.environ['EAPI_CONF'] = get_fixture('env_path.conf')
        pyeapi.client.config.autoload()
        self.assertIn('connection:env_path', pyeapi.client.config.sections())