コード例 #1
0
ファイル: test_common.py プロジェクト: SahilTikale/switchHaaS
 def config_initialize():
     # Use the 'null' backend for these tests
     cfg.add_section('general')
     cfg.set('general', 'driver', 'null')
     cfg.add_section('devel')
     cfg.set('devel', 'dry_run', True)
     cfg.add_section('headnode')
     cfg.set('headnode', 'base_imgs', 'base-headnode, img1, img2, img3, img4')
コード例 #2
0
ファイル: test_common.py プロジェクト: SahilTikale/switchHaaS
 def config_initialize():
     # Use the 'null' backend for these tests
     cfg.add_section('general')
     cfg.set('general', 'driver', 'null')
     cfg.add_section('devel')
     cfg.set('devel', 'dry_run', True)
     cfg.add_section('headnode')
     cfg.set('headnode', 'base_imgs',
             'base-headnode, img1, img2, img3, img4')
コード例 #3
0
ファイル: test_common.py プロジェクト: rahulbahal7/haas
def config_merge(config_dict):
    """Modify the configuration according to ``config_dict``.

    ``config_dict`` should be a dictionary mapping section names (strings)
    to dictionaries mapping option names within a section (again, strings)
    to their values. If the value of a section, or option is None, that
    section or option is removed. Otherwise, the section is created if it
    does not exist, and any options are set to the specified values.
    """
    for section in config_dict.keys():
        if config_dict[section] is None:
            print('remove section: %r' % section)
            cfg.remove_section(section)
        else:
            if not cfg.has_section(section):
                print('add section: %r' % section)
                cfg.add_section(section)
            for option in config_dict[section].keys():
                if config_dict[section][option] is None:
                    print('remove option: %r' % option)
                    cfg.remove_option(section, option)
                else:
                    print('set option: %r' % option)
                    cfg.set(section, option, config_dict[section][option])
コード例 #4
0
ファイル: test_common.py プロジェクト: lokI8/haas
def config_merge(config_dict):
    """Modify the configuration according to ``config_dict``.

    ``config_dict`` should be a dictionary mapping section names (strings)
    to dictionaries mapping option names within a section (again, strings)
    to their values. If the value of a section, or option is None, that
    section or option is removed. Otherwise, the section is created if it
    does not exist, and any options are set to the specified values.
    """
    for section in config_dict.keys():
        if config_dict[section] is None:
            print('remove section: %r' % section)
            cfg.remove_section(section)
        else:
            if not cfg.has_section(section):
                print('add section: %r' % section)
                cfg.add_section(section)
            for option in config_dict[section].keys():
                if config_dict[section][option] is None:
                    print('remove option: %r' % option)
                    cfg.remove_option(section, option)
                else:
                    print('set option: %r' % option)
                    cfg.set(section, option, config_dict[section][option])
コード例 #5
0
 def config_initialize():
     # Use the 'dell' backend for these tests
     cfg.add_section('general')
     cfg.set('general', 'driver', 'simple_vlan')
     cfg.add_section('vlan')
     cfg.set('vlan', 'vlans', vlan_list)
     cfg.add_section('driver simple_vlan')
     cfg.set('driver simple_vlan', 'switch',
             '{"name":"1", "switch":"test"}')
     cfg.set('driver simple_vlan', 'trunk_port', 'unused')
コード例 #6
0
ファイル: simple_vlan.py プロジェクト: SahilTikale/switchHaaS
 def config_initialize():
     # Use the 'dell' backend for these tests
     cfg.add_section('general')
     cfg.set('general', 'driver', 'simple_vlan')
     cfg.add_section('vlan')
     cfg.set('vlan', 'vlans', vlan_list)
     cfg.add_section('driver simple_vlan')
     cfg.set('driver simple_vlan', 'switch',
             '{"name":"1", "switch":"test"}')
     cfg.set('driver simple_vlan', 'trunk_port', 'unused')
コード例 #7
0
 def config_initialize():
     # Use the complex vlan driver for these tests
     cfg.add_section('general')
     cfg.set('general', 'driver', 'complex_vlan')
     cfg.add_section('vlan')
     cfg.set('vlan', 'vlans', vlan_list)
     cfg.add_section('driver complex_vlan')
     cfg.set('driver complex_vlan', 'switch', '[' \
                 '{"name":"0", "switch":"test"}, ' \
                 '{"name":"1", "switch":"test"}, ' \
                 '{"name":"2", "switch":"test"}]')
     cfg.set('driver complex_vlan', 'trunk_ports', '[]')
コード例 #8
0
 def config_initialize():
     # Use the complex vlan driver for these tests
     cfg.add_section("general")
     cfg.set("general", "driver", "complex_vlan")
     cfg.add_section("vlan")
     cfg.set("vlan", "vlans", vlan_list)
     cfg.add_section("driver complex_vlan")
     cfg.set(
         "driver complex_vlan",
         "switch",
         "["
         '{"name":"0", "switch":"test"}, '
         '{"name":"1", "switch":"test"}, '
         '{"name":"2", "switch":"test"}]',
     )
     cfg.set("driver complex_vlan", "trunk_ports", "[]")
コード例 #9
0
def _dry(func):
    cfg.add_section('devel')
    cfg.set('devel', 'dry_run', True)
    func()
コード例 #10
0
ファイル: dev_support.py プロジェクト: SahilTikale/switchHaaS
def _dry(func):
    cfg.add_section('devel')
    cfg.set('devel', 'dry_run', True)
    func()
コード例 #11
0
 def config_initialize():
     # Use the 'dell' backend for these tests
     cfg.add_section('general')
     cfg.set('general', 'driver', 'null_vlan')
     cfg.add_section('vlan')
     cfg.set('vlan', 'vlans', vlan_list)