def test_set_trunk_native_vlan(self): for intf in self.INTERFACES: vid = random_vlan() cmds = ['interface %s' % intf, 'switchport trunk native vlan %s' % vid] func = function('set_trunk_native_vlan', intf, vid) self.eapi_positive_config_test(func, cmds)
def test_vlan_functions(self): for name in ['create', 'delete', 'default']: vid = random_vlan() if name == 'create': cmds = 'vlan %s' % vid elif name == 'delete': cmds = 'no vlan %s' % vid elif name == 'default': cmds = 'default vlan %s' % vid func = function(name, vid) self.eapi_positive_config_test(func, cmds)
def test_set_name(self): for state in ['config', 'negate', 'default']: vid = random_vlan() name = random_string() if state == 'config': cmds = ['vlan %s' % vid, 'name %s' % name] func = function('set_name', vid, name) elif state == 'negate': cmds = ['vlan %s' % vid, 'no name'] func = function('set_name', vid, disable=True) elif state == 'default': cmds = ['vlan %s' % vid, 'default name'] func = function('set_name', vid, default=True) self.eapi_positive_config_test(func, cmds)
def test_set_name(self): for state in ['config', 'negate', 'default']: vid = random_vlan() name = random_string() if state == 'config': cmds = ['vlan %s' % vid, 'name %s' % name] func = function('set_name', vid, name) elif state == 'negate': cmds = ['vlan %s' % vid, 'no name'] func = function('set_name', vid) elif state == 'default': cmds = ['vlan %s' % vid, 'default name'] func = function('set_name', vid, default=True) self.eapi_positive_config_test(func, cmds)
def test_set_state(self): for state in ['config', 'negate', 'default']: vid = random_vlan() if state == 'config': for value in ['active', 'suspend']: cmds = ['vlan %s' % vid, 'state %s' % value] func = function('set_state', vid, value) self.eapi_positive_config_test(func, cmds) elif state == 'negate': cmds = ['vlan %s' % vid, 'no state'] func = function('set_state', vid, disable=True) self.eapi_positive_config_test(func, cmds) elif state == 'default': cmds = ['vlan %s' % vid, 'default state'] func = function('set_state', vid, default=True) self.eapi_positive_config_test(func, cmds)
def test_set_state(self): for state in ['config', 'negate', 'default']: vid = random_vlan() if state == 'config': for value in ['active', 'suspend']: cmds = ['vlan %s' % vid, 'state %s' % value] func = function('set_state', vid, value) self.eapi_positive_config_test(func, cmds) elif state == 'negate': cmds = ['vlan %s' % vid, 'no state'] func = function('set_state', vid) self.eapi_positive_config_test(func, cmds) elif state == 'default': cmds = ['vlan %s' % vid, 'default state'] func = function('set_state', vid, default=True) self.eapi_positive_config_test(func, cmds)
def test_remove_trunk_group(self): vid = random_vlan() tg = random_string() cmds = ['vlan %s' % vid, 'no trunk group %s' % tg] func = function('remove_trunk_group', vid, tg) self.eapi_positive_config_test(func, cmds)
def test_set_trunk_groups_default(self): vid = random_vlan() cmds = ['vlan %s' % vid, 'default trunk group'] func = function('set_trunk_groups', vid, default=True) self.eapi_positive_config_test(func, cmds)