def create_dependencies(self, fw, state): state.eth_obj = None state.eth = testlib.get_available_interfaces(fw)[0] state.eth_obj = network.EthernetInterface(state.eth, 'layer3', testlib.random_ip('/24')) fw.add(state.eth_obj) state.eth_obj.create()
def create_dependencies(self, fw, state): state.eth_obj = None state.eth = testlib.get_available_interfaces(fw)[0] state.eth_obj = network.EthernetInterface( state.eth, 'layer3', testlib.random_ip('/24')) fw.add(state.eth_obj) state.eth_obj.create()
def create_dependencies(self, fw, state): state.eth_objs = [] state.eths = testlib.get_available_interfaces(fw, 3) for eth in state.eths: state.eth_objs.append(network.EthernetInterface( eth, 'virtual-wire')) fw.add(state.eth_objs[-1]) state.eth_objs[-1].create()
def create_dependencies(self, fw, state): state.eth = None state.eth = testlib.get_available_interfaces(fw)[0] state.parent = network.EthernetInterface( state.eth, 'layer2', ) fw.add(state.parent) state.parent.create()
def create_dependencies(self, fw, state): state.eth_objs = [] state.eths = testlib.get_available_interfaces(fw, 3) for eth in state.eths: state.eth_objs.append( network.EthernetInterface(eth, 'virtual-wire')) fw.add(state.eth_objs[-1]) state.eth_objs[-1].create()
def create_dependencies(self, fw, state): state.eth_objs = [] state.eths = testlib.get_available_interfaces(fw, 2) state.eth_objs.append(network.EthernetInterface(state.eths[0], 'layer2')) state.eth_objs.append(network.EthernetInterface(state.eths[1], 'layer3')) for x in state.eth_objs: fw.add(x) fw.create_type(network.EthernetInterface)
def test_01_setup(self, dev, state_map): state = state_map.setdefault(dev) state.err = True state.fail_func = pytest.skip state.parent = dev state.tmpl = None state.name = None state.obj = None state.targets = [testlib.random_name() for x in range(2)] if self.FUNC is None: pytest.skip('{0}.FUNC must be defined'.format( self.__class__.__name__)) elif self.CLASS is None: pytest.skip('{0}.CLASS must be defined'.format( self.__class__.__name__)) elif self.PARAM is None: pytest.skip('{0}.PARAM must be defined'.format( self.__class__.__name__)) if isinstance(state.parent, Panorama): tmpl = Template(testlib.random_name()) state.parent.add(tmpl) v = Vsys('vsys2') tmpl.add(v) state.parent = v tmpl.create() state.tmpl = tmpl else: vsys_list = [ x.name for x in Vsys.refreshall(dev, add=False, name_only=True) ] if 'vsys2' not in vsys_list: pytest.skip('Firewall needs vsys2 to exist') cls_args = {} eth_args = {'mode': 'layer3'} if self.CLASS == Vlan: eth_args['mode'] = 'layer2' elif self.CLASS == Zone: cls_args['mode'] = 'layer3' state.name = testlib.get_available_interfaces(state.parent)[0] state.obj = EthernetInterface(state.name, **eth_args) state.parent.add(state.obj) if state.tmpl is None: dev.vsys = 'vsys2' instances = [ self.CLASS(state.targets[x], **cls_args) for x in range(2) ] for x in instances: state.parent.add(x) x.create() state.err = False
def create_dependencies(self, fw, state): state.eth_objs = [] state.eths = testlib.get_available_interfaces(fw, 2) state.eth_objs.append( network.EthernetInterface(state.eths[0], 'layer2')) state.eth_objs.append( network.EthernetInterface(state.eths[1], 'layer3')) for x in state.eth_objs: fw.add(x) fw.create_type(network.EthernetInterface)
def create_dependencies(self, fw, state): state.management_profiles = [] state.eth = testlib.get_available_interfaces(fw)[0] state.management_profiles = [ network.ManagementProfile(testlib.random_name(), ping=bool(x)) for x in range(2)] for x in state.management_profiles: fw.add(x) state.management_profiles[0].create_similar()
def create_dependencies(self, fw, state): state.management_profiles = [] state.eth = testlib.get_available_interfaces(fw)[0] state.management_profiles = [ network.ManagementProfile(testlib.random_name(), ping=bool(x)) for x in range(2) ] for x in state.management_profiles: fw.add(x) state.management_profiles[0].create_similar()
def test_01_setup(self, dev, state_map): state = state_map.setdefault(dev) state.err = True state.fail_func = pytest.skip state.parent = dev state.tmpl = None state.name = None state.obj = None state.targets = [testlib.random_name() for x in range(2)] if self.FUNC is None: pytest.skip('{0}.FUNC must be defined'.format( self.__class__.__name__)) elif self.CLASS is None: pytest.skip('{0}.CLASS must be defined'.format( self.__class__.__name__)) elif self.PARAM is None: pytest.skip('{0}.PARAM must be defined'.format( self.__class__.__name__)) if isinstance(state.parent, Panorama): tmpl = Template(testlib.random_name()) state.parent.add(tmpl) v = Vsys('vsys2') tmpl.add(v) state.parent = v tmpl.create() state.tmpl = tmpl else: vsys_list = [x.name for x in Vsys.refreshall(dev, add=False, name_only=True)] if 'vsys2' not in vsys_list: pytest.skip('Firewall needs vsys2 to exist') cls_args = {} eth_args = {'mode': 'layer3'} if self.CLASS == Vlan: eth_args['mode'] = 'layer2' elif self.CLASS == Zone: cls_args['mode'] = 'layer3' state.name = testlib.get_available_interfaces(state.parent)[0] state.obj = EthernetInterface(state.name, **eth_args) state.parent.add(state.obj) if state.tmpl is None: dev.vsys = 'vsys2' instances = [self.CLASS(state.targets[x], **cls_args) for x in range(2)] for x in instances: state.parent.add(x) x.create() state.err = False
def create_dependencies(self, fw, state): state.management_profiles = [] state.eth = testlib.get_available_interfaces(fw)[0] state.management_profiles = [ network.ManagementProfile(testlib.random_name(), ping=True, ssh=True, https=False) for x in range(2) ] for x in state.management_profiles: fw.add(x) x.create()
def create_dependencies(self, fw, state): state.eth_obj = None state.eth = testlib.get_available_interfaces(fw)[0] state.eth_obj = network.EthernetInterface( state.eth, 'layer3', testlib.random_ip('/24'), ipv6_enabled=True) fw.add(state.eth_obj) state.eth_obj.create() state.vr = network.VirtualRouter( testlib.random_name(), interface=state.eth) fw.add(state.vr) state.vr.create()
def create_dependencies(self, fw, state): state.eth_objs = [] state.eths = testlib.get_available_interfaces(fw, 2) for eth in state.eths: state.eth_objs.append(network.EthernetInterface(eth, 'layer2')) fw.add(state.eth_objs[-1]) state.eth_objs[0].create_similar() state.vlan_interface = network.VlanInterface('vlan.{0}'.format( random.randint(100, 200))) fw.add(state.vlan_interface) state.vlan_interface.create()
def create_dependencies(self, fw, state): state.eth_obj = None state.eth = testlib.get_available_interfaces(fw)[0] state.eth_obj = network.EthernetInterface(state.eth, 'layer3', testlib.random_ip('/24')) fw.add(state.eth_obj) state.eth_obj.create() tag = random.randint(1, 4000) state.parent = network.Layer3Subinterface( '{0}.{1}'.format(state.eth, tag), tag, testlib.random_ip('/24')) state.eth_obj.add(state.parent) state.parent.create()
def create_dependencies(self, fw, state): state.management_profile = network.ManagementProfile( testlib.random_name(), ping=True) state.eth = None fw.add(state.management_profile) state.management_profile.create() state.eth = testlib.get_available_interfaces(fw)[0] state.parent = network.EthernetInterface( state.eth, 'layer3', ip=testlib.random_ip('/24'), ) fw.add(state.parent) state.parent.create()
def create_dependencies(self, fw, state): state.parent = None state.eth_objs = [] state.eths = testlib.get_available_interfaces(fw, 2) for eth in state.eths: state.eth_objs.append(network.EthernetInterface(eth, 'layer2')) fw.add(state.eth_objs[-1]) state.eth_objs[0].create_similar() state.parent = network.Vlan(testlib.random_name(), state.eths) fw.add(state.parent) state.parent.create()
def create_dependencies(self, fw, state): state.eth_obj = None state.eth = testlib.get_available_interfaces(fw)[0] state.eth_obj = network.EthernetInterface(state.eth, 'layer3', testlib.random_ip('/24'), ipv6_enabled=True) fw.add(state.eth_obj) state.eth_obj.create() state.vr = network.VirtualRouter(testlib.random_name(), interface=state.eth) fw.add(state.vr) state.vr.create()
def create_dependencies(self, fw, state): state.eth_objs = [] state.eths = testlib.get_available_interfaces(fw, 2) for eth in state.eths: state.eth_objs.append(network.EthernetInterface( eth, 'layer2')) fw.add(state.eth_objs[-1]) state.eth_objs[0].create_similar() state.vlan_interface = network.VlanInterface( 'vlan.{0}'.format(random.randint(100, 200))) fw.add(state.vlan_interface) state.vlan_interface.create()
def create_dependencies(self, fw, state): state.eth_obj = None state.eth = testlib.get_available_interfaces(fw)[0] state.eth_obj = network.EthernetInterface( state.eth, 'layer3', testlib.random_ip('/24')) fw.add(state.eth_obj) state.eth_obj.create() tag = random.randint(1, 4000) state.parent = network.Layer3Subinterface( '{0}.{1}'.format(state.eth, tag), tag, testlib.random_ip('/24')) state.eth_obj.add(state.parent) state.parent.create()
def create_dependencies(self, fw, state): state.eth_objs = [] state.vr = None state.eths = testlib.get_available_interfaces(fw, 2) for e in state.eths: state.eth_objs.append( network.EthernetInterface(e, 'layer3', testlib.random_ip('/24'))) fw.add(state.eth_objs[-1]) state.eth_objs[-1].create() state.vr = network.VirtualRouter(testlib.random_name(), state.eths) fw.add(state.vr) state.vr.create()
def create_dependencies(self, fw, state): state.parent = None state.eth_objs = [] state.eths = testlib.get_available_interfaces(fw, 2) for eth in state.eths: state.eth_objs.append(network.EthernetInterface( eth, 'layer2')) fw.add(state.eth_objs[-1]) state.eth_objs[0].create_similar() state.parent = network.Vlan( testlib.random_name(), state.eths) fw.add(state.parent) state.parent.create()
def test_01_setup(self, dev, state_map): state = state_map.setdefault(dev) state.err = True state.fail_func = pytest.skip state.parent = dev state.name = None state.delete_parent = False state.obj = None if self.CLASS is None: pytest.skip('{0}.CLASS must be defined'.format( self.__class__.__name__)) elif self.VSYS_PARAM is None: pytest.skip('{0}.VSYS_PARAM must be defined'.format( self.__class__.__name__)) if isinstance(state.parent, Panorama): tmpl = Template(testlib.random_name()) state.parent.add(tmpl) state.parent = tmpl state.parent.add(Vsys('vsys1')) state.parent.add(Vsys('vsys2')) state.parent.add(Vsys('vsys3')) state.parent.create() state.delete_parent = True else: vsys_list = [ x.name for x in Vsys.refreshall(dev, add=False, name_only=True) ] if not all('vsys{0}'.format(x) in vsys_list for x in range(1, 4)): pytest.skip('Firewall needs vsys1 - vsys3 to exist') args = {} if self.CLASS == EthernetInterface: state.name = testlib.get_available_interfaces(state.parent)[0] args = {'mode': 'layer3'} else: state.name = testlib.random_name() state.obj = self.CLASS(state.name, **args) state.parent.add(state.obj) state.err = False
def test_01_setup(self, dev, state_map): state = state_map.setdefault(dev) state.err = True state.fail_func = pytest.skip state.parent = dev state.name = None state.delete_parent = False state.obj = None if self.CLASS is None: pytest.skip('{0}.CLASS must be defined'.format( self.__class__.__name__)) elif self.VSYS_PARAM is None: pytest.skip('{0}.VSYS_PARAM must be defined'.format( self.__class__.__name__)) if isinstance(state.parent, Panorama): tmpl = Template(testlib.random_name()) state.parent.add(tmpl) state.parent = tmpl state.parent.add(Vsys('vsys1')) state.parent.add(Vsys('vsys2')) state.parent.add(Vsys('vsys3')) state.parent.create() state.delete_parent = True else: vsys_list = [x.name for x in Vsys.refreshall(dev, add=False, name_only=True)] if not all('vsys{0}'.format(x) in vsys_list for x in range(1, 4)): pytest.skip('Firewall needs vsys1 - vsys3 to exist') args = {} if self.CLASS == EthernetInterface: state.name = testlib.get_available_interfaces(state.parent)[0] args = {'mode': 'layer3'} else: state.name = testlib.random_name() state.obj = self.CLASS(state.name, **args) state.parent.add(state.obj) state.err = False
def create_dependencies(self, fw, state): state.eths = testlib.get_available_interfaces(fw, 2) state.eth_obj_v4 = network.EthernetInterface(state.eths[0], 'layer3', testlib.random_ip('/24')) fw.add(state.eth_obj_v4) state.eth_obj_v6 = network.EthernetInterface(state.eths[1], 'layer3', ipv6_enabled=True) fw.add(state.eth_obj_v6) state.eth_obj_v4.create_similar() state.vr = network.VirtualRouter(testlib.random_name(), state.eths) fw.add(state.vr) state.vr.create() if any((self.WITH_OSPF, self.WITH_AUTH_PROFILE, self.WITH_AREA, self.WITH_AREA_INTERFACE)): state.ospf = network.Ospf(True, testlib.random_ip()) state.vr.add(state.ospf) if self.WITH_AUTH_PROFILE: state.auth = network.OspfAuthProfile(testlib.random_name(), 'md5') state.ospf.add(state.auth) if self.WITH_AREA or self.WITH_AREA_INTERFACE: state.area = network.OspfArea(testlib.random_ip()) state.ospf.add(state.area) if self.WITH_AREA_INTERFACE: state.iface = network.OspfAreaInterface( state.eths[0], True, True, 'p2mp') state.area.add(state.iface) state.ospf.create()
def create_dependencies(self, fw, state): state.eths = testlib.get_available_interfaces(fw, 2) state.eth_obj_v4 = network.EthernetInterface( state.eths[0], 'layer3', testlib.random_ip('/24')) fw.add(state.eth_obj_v4) state.eth_obj_v6 = network.EthernetInterface( state.eths[1], 'layer3', ipv6_enabled=True) fw.add(state.eth_obj_v6) state.eth_obj_v4.create_similar() state.vr = network.VirtualRouter(testlib.random_name(), state.eths) fw.add(state.vr) state.vr.create() if any((self.WITH_OSPF, self.WITH_AUTH_PROFILE, self.WITH_AREA, self.WITH_AREA_INTERFACE)): state.ospf = network.Ospf( True, testlib.random_ip()) state.vr.add(state.ospf) if self.WITH_AUTH_PROFILE: state.auth = network.OspfAuthProfile( testlib.random_name(), 'md5') state.ospf.add(state.auth) if self.WITH_AREA or self.WITH_AREA_INTERFACE: state.area = network.OspfArea(testlib.random_ip()) state.ospf.add(state.area) if self.WITH_AREA_INTERFACE: state.iface = network.OspfAreaInterface( state.eths[0], True, True, 'p2mp') state.area.add(state.iface) state.ospf.create()