< NET > MAC

转载:

http://baike.baidu.com/view/32702.htm#sub4924694


Media Access Control

媒体介入控制层,属于OSI模型中数据链路层下层子层。

介质访问控制

它定义了数据帧怎样在介质上进行传输。在共享同一个带宽的链路中,对连接介质的访问是“先来先服务”的。物理寻址在此处被定义,逻辑拓扑(信号通过物理拓扑的路径)也在此处被定义。线路控制、出错通知(不纠正)、帧的传递顺序和可选择的流量控制也在这一子层实现。


该协议位于OSI七层协议中数据链路层,数据链路层分为上层LLC(逻辑链路控制),和下层的MAC(介质访问控制),MAC主要负责控制与连接物理层的物理介质。在发送数据的时候,MAC协议可以事先判断是否可以发送数据,如果可以发送将给数据加上一些控制信息,最终将数据以及控制信息以规定的格式发送到物理层;在接收数据的时候,MAC协议首先判断输入的信息并是否发生传输错误,如果没有错误,则去掉控制信息发送至LLC(逻辑链路控制)层。


不管是在传统的有线局域网(LAN)中还是在目前流行的无线局域网(WLAN)中,MAC协议都被广泛地应用。在传统局域网中,各种传输介质的物理层对应到相应的MAC层,目前普遍使用的网络采用的是IEEE 802.3的MAC层标准,采用CSMA/CD访问控制方式;而在无线局域网中,MAC所对应的标准为IEEE 802.11,其工作方式采用DCF(分布控制)和PCF(中心控制)。

#!/usr/bin/env python -- coding: UTF-8 -- --------------------------------------------------------- Copyright (C), 2025, Lianzhou International Co.,Ltd. description: TS887553__nd_detection_basic_test.py Author: dengshudan@tp-link.com.hk history: 2025/8/26 13:48, dengshudan@tp-link.com.hk, Created. --------------------------------------------------------- import time from pysat.sat_test import TestCase, CaseInfo from pysat.sat_result import ResultInfo from testbed_init.un_bvt_switch import testbed_util as testbed from pysat.testbeds_def import UN_BVT_SWITCH from pysat import sat_conf from PyLogger import logging from PySwitchCtrl import * import stc_ctrl as stc import special_frame_global as db import random import network_security_global_config logging handle logger = logging.getLogger(name) class NdDetectionBasicTest(TestCase): def __init__(self): TestCase.__init__(self) self.logger = logging.getLogger(self.__class__.__name__) # define the case info self.case_info = CaseInfo() self.case_info.name = 'nd_detection_basic_test' self.case_info.id = 'TS887553' # the id of the test case in 'Testlink' self.case_info.version = '20250827' # test case version self.case_info.auther = 'dengshudan@tp-link.net' # auther of the test case self.case_info.testbeds = [UN_BVT_SWITCH] # testbeds in which the case could run self.case_info.description = ''' ''' def add_task(self): # register the class self.register_case(self.nd_detection_basic_test, self.case_info) def nd_detection_basic_test(self): result = ResultInfo() test_comment = '' stc_ip = db.get_config('stc_ip') stc_port1 = db.get_config('STC_PORT1') stc_port2 = db.get_config('STC_PORT2') stc_port3 = db.get_config('STC_PORT3') stc_port4 = db.get_config('STC_PORT4') stc_port5 = db.get_config('STC_PORT5') self.logger.info('stc_ip is %s' % stc_ip) self.logger.info('stc_port1 is %s' % stc_port1) self.logger.info('stc_port2 is %s' % stc_port2) self.logger.info('stc_port3 is %s' % stc_port3) self.logger.info('stc_port4 is %s' % stc_port4) self.logger.info('stc_port5 is %s' % stc_port5) try: # [Pre-condition]: Login in DUT self.logger.info('[Pre-condition]: Login in DUT...') client1 = testbed.Client1() client1.dut_iface.open() client1.dut_iface.login() dut_port_type_list, dut_port_list, dut_port_type_short_list = network_security_global_config.get_port_id(client1) # [Pre-condition]: reserve STC cards self.logger.info('[Pre-condition]: start to reserve STC ports...') port1 = stc.Port.Port(stc_ip, stc_port1, 0, 0, 0) port2 = stc.Port.Port(stc_ip, stc_port2, 0, 0, 0) port3 = stc.Port.Port(stc_ip, stc_port3, 0, 0, 0) port4 = stc.Port.Port(stc_ip, stc_port4, 0, 0, 0) port5 = stc.Port.Port(stc_ip, stc_port5, 0, 0, 0) # [Pre-condition]: init STC ports self.logger.info('[Pre-condition]: STC ports initializing...') port1.SubscribeGenerator() port1.SubscribeAnalyzer() port2.SubscribeGenerator() port2.SubscribeAnalyzer() port3.SubscribeGenerator() port3.SubscribeAnalyzer() port4.SubscribeGenerator() port4.SubscribeAnalyzer() port5.SubscribeGenerator() port5.SubscribeAnalyzer() # [Step 1.1]: Configure the DUT try: self.logger.info('[Step 1.1]: Configure the DUT') client1.dut_iface.set_configure_mode() client1.dut_iface.exec_command('#') client1.dut_iface.exec_command('vlan 4094') client1.dut_iface.exec_command('name "4094"') client1.dut_iface.exec_command('#') client1.dut_iface.exec_command('ipv6 source binding %s %s %s vlan %s interface %s %s %s' % ('1', '2001::1', '00:00:00:00:00:01', '1', dut_port_type_list[1], dut_port_list[1], 'nd-detection')) client1.dut_iface.exec_command('ipv6 source binding %s %s %s vlan %s interface %s %s %s' % ('2', '2001::2', '00:00:00:00:00:02', '4094', dut_port_type_list[1], dut_port_list[1], 'nd-detection')) client1.dut_iface.exec_command('ipv6 source binding %s %s %s vlan %s interface %s %s %s' % ('3', 'fe80::200:ff:fe00:1', '00:00:00:00:00:01', '1', dut_port_type_list[1], dut_port_list[1], 'nd-detection')) client1.dut_iface.exec_command('#') client1.dut_iface.exec_command('ipv6 nd detection') client1.dut_iface.exec_command('ipv6 nd detection vlan 1,4094') client1.dut_iface.exec_command('ipv6 nd detection vlan 1,4094 logging') client1.dut_iface.exec_command('#') client1.dut_iface.exec_command('interface %s %s' % (dut_port_type_list[1], dut_port_list[1])) client1.dut_iface.exec_command('switchport general allowed vlan 4094 tagged') client1.dut_iface.exec_command('#') client1.dut_iface.exec_command('interface %s %s' % (dut_port_type_list[2], dut_port_list[2])) client1.dut_iface.exec_command('switchport general allowed vlan 4094 tagged') client1.dut_iface.exec_command('interface %s %s' % (dut_port_type_list[5], dut_port_list[5])) client1.dut_iface.exec_command('ipv6 nd detection trust') client1.dut_iface.exec_command('#') except Exception, e: self.logger.debug('[Step 1.1]: Failed to Configure the DUT') self.break_test('[Step 1.1]: %s' % (e)) # [Step 1.2]: delete default streamblocks self.logger.info('[Step 1.2]: deleting default streamblocks...') stc.Create.Delete('stc', port1.streamblock.getstreamblockhandle()) stc.Create.Delete('stc', port2.streamblock.getstreamblockhandle()) stc.Create.Delete('stc', port3.streamblock.getstreamblockhandle()) stc.Create.Delete('stc', port4.streamblock.getstreamblockhandle()) stc.Create.Delete('stc', port5.streamblock.getstreamblockhandle()) # [Step 1.2]: create streamblock1 NS_match self.logger.info('[Step 1.2]: creating streamblock1...') frame_1 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble minByteLength="8" >fb555555555555d5</preamble><dstMac>33:33:FF:00:00:11</dstMac><srcMac>00:00:00:00:00:01</srcMac></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::1</sourceAddr><destAddr>FF02::1:FF00:11</destAddr></pdu><pdu name="NeighborSolicitation_1" pdu="icmpv6:NeighborSolicitation"><targetAddress>2001::11</targetAddress></pdu></pdus></config></frame>' streamblock1 = port1.addstreamblock() streamblock1.SetAutoFrameLength_ratebased() streamblock1.SetInsertSig_ratebased('TRUE') streamblock1.SetFrameConfig_ratebased(frameconfig=frame_1) # [Step 1.2]: create streamblock2 NS_mac_not_match self.logger.info('[Step 1.2]: creating streamblock2...') frame_2 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble minByteLength="8" >fb555555555555d5</preamble><dstMac>33:33:FF:00:00:11</dstMac><srcMac>00:00:00:00:00:0A</srcMac></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::1</sourceAddr><destAddr>FF02::1:FF00:11</destAddr></pdu><pdu name="NeighborSolicitation_1" pdu="icmpv6:NeighborSolicitation"><targetAddress>2001::11</targetAddress></pdu></pdus></config></frame>' streamblock2 = port1.addstreamblock() streamblock2.SetAutoFrameLength_ratebased() streamblock2.SetInsertSig_ratebased('TRUE') streamblock2.SetFrameConfig_ratebased(frameconfig=frame_2) # [Step 1.2]: create streamblock3 NS_ip_not_match self.logger.info('[Step 1.2]: creating streamblock3...') frame_3 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble minByteLength="8" >fb555555555555d5</preamble><dstMac>33:33:FF:00:00:11</dstMac><srcMac>00:00:00:00:00:01</srcMac></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::a</sourceAddr><destAddr>FF02::1:FF00:11</destAddr></pdu><pdu name="NeighborSolicitation_1" pdu="icmpv6:NeighborSolicitation"><targetAddress>2001::11</targetAddress></pdu></pdus></config></frame>' streamblock3 = port1.addstreamblock() streamblock3.SetAutoFrameLength_ratebased() streamblock3.SetInsertSig_ratebased('TRUE') streamblock3.SetFrameConfig_ratebased(frameconfig=frame_3) # [Step 1.2]: create streamblock4 NS_vlan_not_match self.logger.info('[Step 1.2]: creating streamblock4...') frame_4 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble minByteLength="8" >fb555555555555d5</preamble><dstMac>33:33:FF:00:00:11</dstMac><srcMac>00:00:00:00:00:01</srcMac><vlans name="anon_20694"><Vlan name="Vlan"><pri>000</pri><id>4094</id></Vlan></vlans></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::1</sourceAddr><destAddr>FF02::1:FF00:11</destAddr></pdu><pdu name="NeighborSolicitation_1" pdu="icmpv6:NeighborSolicitation"><targetAddress>2001::11</targetAddress></pdu></pdus></config></frame>' streamblock4 = port1.addstreamblock() streamblock4.SetAutoFrameLength_ratebased() streamblock4.SetInsertSig_ratebased('TRUE') streamblock4.SetFrameConfig_ratebased(frameconfig=frame_4) # [Step 1.2]: create streamblock5 IP_match self.logger.info('[Step 1.2]: creating streamblock5...') frame_5 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble>fb555555555555d5</preamble><dstMac>00:00:00:00:00:99</dstMac><srcMac>00:00:00:00:00:01</srcMac></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::1</sourceAddr><destAddr>2001::11</destAddr></pdu></pdus></config></frame>' streamblock5 = port1.addstreamblock() streamblock5.SetAutoFrameLength_ratebased() streamblock5.SetInsertSig_ratebased('TRUE') streamblock5.SetFrameConfig_ratebased(frameconfig=frame_5) # [Step 1.2]: create streamblock6 IP_not_match self.logger.info('[Step 1.2]: creating streamblock6...') frame_6 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble>fb555555555555d5</preamble><dstMac>00:00:00:00:00:99</dstMac><srcMac>00:00:00:00:00:0A</srcMac></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::1</sourceAddr><destAddr>2001::11</destAddr></pdu></pdus></config></frame>' streamblock6 = port1.addstreamblock() streamblock6.SetAutoFrameLength_ratebased() streamblock6.SetInsertSig_ratebased('TRUE') streamblock6.SetFrameConfig_ratebased(frameconfig=frame_6) # [Step 1.2]: create streamblock7 NA_match self.logger.info('[Step 1.2]: creating streamblock7...') frame_7 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble minByteLength="8" >fb555555555555d5</preamble><dstMac>33:33:FF:00:00:22</dstMac><srcMac>00:00:00:00:00:02</srcMac><vlans name="anon_20703"><Vlan name="Vlan"><pri>000</pri><id>4094</id></Vlan></vlans></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::2</sourceAddr><destAddr>2001::22</destAddr></pdu><pdu name="NeighborAdvertisement_1" pdu="icmpv6:NeighborAdvertisement"><targetAddress>2001::22</targetAddress></pdu></pdus></config></frame>' streamblock7 = port1.addstreamblock() streamblock7.SetAutoFrameLength_ratebased() streamblock7.SetInsertSig_ratebased('TRUE') streamblock7.SetFrameConfig_ratebased(frameconfig=frame_7) # [Step 1.2]: create streamblock8 NA_mac_not_match self.logger.info('[Step 1.2]: creating streamblock8...') frame_8 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble minByteLength="8" >fb555555555555d5</preamble><dstMac>33:33:FF:00:00:22</dstMac><srcMac>00:00:00:00:00:0B</srcMac><vlans name="anon_20712"><Vlan name="Vlan"><pri>000</pri><id>4094</id></Vlan></vlans></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::2</sourceAddr><destAddr>2001::22</destAddr></pdu><pdu name="NeighborAdvertisement_1" pdu="icmpv6:NeighborAdvertisement"><targetAddress>2001::22</targetAddress></pdu></pdus></config></frame>' streamblock8 = port1.addstreamblock() streamblock8.SetAutoFrameLength_ratebased() streamblock8.SetInsertSig_ratebased('TRUE') streamblock8.SetFrameConfig_ratebased(frameconfig=frame_8) # [Step 1.2]: create streamblock9 NA_ip_not_match self.logger.info('[Step 1.2]: creating streamblock9...') frame_9 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble minByteLength="8" >fb555555555555d5</preamble><dstMac>33:33:FF:00:00:22</dstMac><srcMac>00:00:00:00:00:02</srcMac><vlans name="anon_20721"><Vlan name="Vlan"><pri>000</pri><id>4094</id></Vlan></vlans></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::b</sourceAddr><destAddr>2001::22</destAddr></pdu><pdu name="NeighborAdvertisement_1" pdu="icmpv6:NeighborAdvertisement"><targetAddress>2001::22</targetAddress></pdu></pdus></config></frame>' streamblock9 = port1.addstreamblock() streamblock9.SetAutoFrameLength_ratebased() streamblock9.SetInsertSig_ratebased('TRUE') streamblock9.SetFrameConfig_ratebased(frameconfig=frame_9) # [Step 1.2]: create streamblock10 NA_vlan_not_match self.logger.info('[Step 1.2]: creating streamblock10...') frame_10 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble minByteLength="8" >fb555555555555d5</preamble><dstMac>33:33:FF:00:00:22</dstMac><srcMac>00:00:00:00:00:02</srcMac><vlans name="anon_20730"><Vlan name="Vlan"><pri>000</pri><id>1</id></Vlan></vlans></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::2</sourceAddr><destAddr>2001::22</destAddr></pdu><pdu name="NeighborAdvertisement_1" pdu="icmpv6:NeighborAdvertisement"><targetAddress>2001::22</targetAddress></pdu></pdus></config></frame>' streamblock10 = port1.addstreamblock() streamblock10.SetAutoFrameLength_ratebased() streamblock10.SetInsertSig_ratebased('TRUE') streamblock10.SetFrameConfig_ratebased(frameconfig=frame_10) # [Step 1.2]: create streamblock11 IP_match self.logger.info('[Step 1.2]: creating streamblock11...') frame_11 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble minByteLength="8" >fb555555555555d5</preamble><dstMac>00:00:00:00:00:22</dstMac><srcMac>00:00:00:00:00:02</srcMac><vlans name="anon_20739"><Vlan name="Vlan"><pri>000</pri><id>4094</id></Vlan></vlans></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::2</sourceAddr><destAddr>2001::22</destAddr></pdu></pdus></config></frame>' streamblock11 = port1.addstreamblock() streamblock11.SetAutoFrameLength_ratebased() streamblock11.SetInsertSig_ratebased('TRUE') streamblock11.SetFrameConfig_ratebased(frameconfig=frame_11) # [Step 1.2]: create streamblock12 IP_not_match self.logger.info('[Step 1.2]: creating streamblock12...') frame_12 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble minByteLength="8" >fb555555555555d5</preamble><dstMac>00:00:00:00:00:22</dstMac><srcMac>00:00:00:00:00:0A</srcMac><vlans name="anon_20746"><Vlan name="Vlan"><pri>000</pri><id>4094</id></Vlan></vlans></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>2001::2</sourceAddr><destAddr>2001::22</destAddr></pdu></pdus></config></frame>' streamblock12 = port1.addstreamblock() streamblock12.SetAutoFrameLength_ratebased() streamblock12.SetInsertSig_ratebased('TRUE') streamblock12.SetFrameConfig_ratebased(frameconfig=frame_12) # [Step 1.2]: create streamblock13 RS_match self.logger.info('[Step 1.2]: creating streamblock13...') frame_13 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble>fb555555555555d5</preamble><dstMac>33:33:00:00:00:02</dstMac><srcMac>00:00:00:00:00:01</srcMac></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>FE80::0200:00FF:FE00:0001</sourceAddr><destAddr>FF02::2</destAddr></pdu><pdu name="RouterSolicitation_1" pdu="icmpv6:RouterSolicitation"><linkLayerOption name="anon_22242"><LinkLayerAddress name="LinkLayerAddress_0"><value>000000000001</value></LinkLayerAddress></linkLayerOption></pdu></pdus></config></frame>' streamblock13 = port1.addstreamblock() streamblock13.SetAutoFrameLength_ratebased() streamblock13.SetInsertSig_ratebased('TRUE') streamblock13.SetFrameConfig_ratebased(frameconfig=frame_13) # [Step 1.2]: create streamblock14 RS_not_match self.logger.info('[Step 1.2]: creating streamblock14...') frame_14 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble>fb555555555555d5</preamble><dstMac>33:33:00:00:00:02</dstMac><srcMac>00:00:00:00:00:11</srcMac></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>FE80::0200:00FF:FE00:0011</sourceAddr><destAddr>FF02::2</destAddr></pdu><pdu name="RouterSolicitation_1" pdu="icmpv6:RouterSolicitation"><linkLayerOption name="anon_22373"><LinkLayerAddress name="LinkLayerAddress_0"><value>000000000011</value></LinkLayerAddress></linkLayerOption></pdu></pdus></config></frame>' streamblock14 = port1.addstreamblock() streamblock14.SetAutoFrameLength_ratebased() streamblock14.SetInsertSig_ratebased('TRUE') streamblock14.SetFrameConfig_ratebased(frameconfig=frame_14) # [Step 1.2]: create streamblock15 RA_MATCH_not_pass self.logger.info('[Step 1.2]: creating streamblock15...') frame_15 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble>fb555555555555d5</preamble><dstMac>33:33:00:00:00:01</dstMac><srcMac>00:00:00:00:00:01</srcMac></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>FE80::0200:00FF:FE00:0001</sourceAddr><destAddr>FF02::1</destAddr></pdu><pdu name="RouterAdvertisement_1" pdu="icmpv6:RouterAdvertisement"><routerLifetime>3600</routerLifetime><reachableTime>3600</reachableTime><prefixOption name="anon_23046"><PrefixInformation name="PrefixInformation_0"><validLifetime>3600</validLifetime><preferredLifetime>3600</preferredLifetime><prefix>3001::</prefix></PrefixInformation></prefixOption></pdu></pdus></config></frame>' streamblock15 = port1.addstreamblock() streamblock15.SetAutoFrameLength_ratebased() streamblock15.SetInsertSig_ratebased('TRUE') streamblock15.SetFrameConfig_ratebased(frameconfig=frame_15) # [Step 1.2]: create streamblock16 RR_MATCH_not_pass self.logger.info('[Step 1.2]: creating streamblock16...') frame_16 = '<frame><config><pdus><pdu name="eth1" pdu="ethernet:EthernetII"><preamble>fb555555555555d5</preamble><dstMac>33:33:00:00:00:01</dstMac><srcMac>00:00:00:00:00:01</srcMac></pdu><pdu name="proto1" pdu="ipv6:IPv6"><payloadLength>0</payloadLength><sourceAddr>FE80::0200:00FF:FE00:0001</sourceAddr><destAddr>FF02::1</destAddr></pdu><pdu name="Redirect_1" pdu="icmpv6:Redirect"></pdu></pdus></config></frame>' streamblock16 = port1.addstreamblock() streamblock16.SetAutoFrameLength_ratebased() streamblock16.SetInsertSig_ratebased('TRUE') streamblock16.SetFrameConfig_ratebased(frameconfig=frame_16) # [Step 1.2]: save stc config self.logger.info('[Step 1.2]: saving stc config...') stc.StcControl.Apply('stc') stc.StcControl.SaveToTcc('stc', 'ts887553.tcc') ########################################################发流测试############################################################ step_2 = 'Step 2. glabal : disable, vlan_1: disable, vlan_1_log: disable, vlan_4094: disable, vlan_4094_log: disable, send: S1-12' self.logger.info(step_2) client1.dut_iface.exec_command('no ipv6 nd detection') client1.dut_iface.exec_command('no ipv6 nd detection vlan 1,4094') client1.dut_iface.exec_command('no ipv6 nd detection vlan 1,4094 logging') network_security_global_config.send_streamblock_and_check(stc, result, [streamblock1, streamblock2, streamblock3, streamblock4, streamblock5, streamblock6, streamblock7, streamblock8, streamblock9, streamblock10, streamblock11, streamblock12], port1, port2,{port2.port: '12'}, step_2) # log check step_3 = 'Step 3. glabal : disable, vlan_1: disable, vlan_1_log: disable, vlan_4094: enable, vlan_4094_log: enable, send: S1-12' self.logger.info(step_2) client1.dut_iface.exec_command('no ipv6 nd detection') client1.dut_iface.exec_command('no ipv6 nd detection vlan 1') client1.dut_iface.exec_command('no ipv6 nd detection vlan 1 logging') client1.dut_iface.exec_command('ipv6 nd detection vlan 4094') client1.dut_iface.exec_command('ipv6 nd detection vlan 4094 logging') network_security_global_config.send_streamblock_and_check(stc, result, [streamblock1, streamblock2, streamblock3, streamblock4, streamblock5, streamblock6, streamblock7, streamblock8, streamblock9, streamblock10, streamblock11, streamblock12], port1, port2, {port2.port: '12'}, step_2) # log check except Exception as e: # break test by exception result.add_result(passfail=ResultInfo.FAIL, test_comment='Test fail: %s' % e) finally: return result def clean_test(self): try: self.logger.info('[clean_test] start to clean test...') except Exception as e: self.logger.error('[clean_test] clean test failed: %s' % e) raise e 下发完输入2中的CLI,我们应该可以创流发流了,我给的这个参考代码是一个standalone代码,但是这个代码的流和我的用例中的16条流一致,而且创流发流这个操作controller和standalone应该没有区别,你参考这个来帮我接着写吧,写到输入2中发完16条流为止,从step3下发完CLI开始
09-01
下载前必看:https://pan.quark.cn/s/a4b39357ea24 在本资料中,将阐述如何运用JavaScript达成单击下拉列表框选定选项后即时转向对应页面的功能。 此种技术适用于网页布局中用户需迅速选取并转向不同页面的情形,诸如网站导航栏或内容目录等场景。 达成此功能,能够显著改善用户交互体验,精简用户的操作流程。 我们须熟悉HTML里的`<select>`组件,该组件用于构建一个选择列表。 用户可从中选定一项,并可引发一个事件来响应用户的这一选择动作。 在本次实例中,我们借助`onchange`事件监听器来实现当用户在下拉列表框中选定某个选项时,页面能自动转向该选项关联的链接地址。 JavaScript里的`window.location`属性旨在获取或设定浏览器当前载入页面的网址,通过变更该属性的值,能够实现页面的转向。 在本次实例的实现方案里,运用了`eval()`函数来动态执行字符串表达式,这在现代的JavaScript开发实践中通常不被推荐使用,因为它可能诱发安全问题及难以排错的错误。 然而,为了本例的简化展示,我们暂时搁置这一问题,因为在更复杂的实际应用中,可选用其他方法,例如ES6中的模板字符串或其他函数来安全地构建和执行字符串。 具体到本例的代码实现,`MM_jumpMenu`函数负责处理转向逻辑。 它接收三个参数:`targ`、`selObj`和`restore`。 其中`targ`代表要转向的页面,`selObj`是触发事件的下拉列表框对象,`restore`是标志位,用以指示是否需在转向后将下拉列表框的选项恢复至默认的提示项。 函数的实现通过获取`selObj`中当前选定的`selectedIndex`对应的`value`属性值,并将其赋予`...
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值