% Tests for OpenFlow v1.3 with Scapy + Preparation = Be sure we have loaded OpenFlow v3 load_contrib("openflow3") + Usual OFv1.3 messages = OFPTHello(), hello without version bitmap ofm = OFPTHello() raw(ofm) == b'\x04\x00\x00\x08\x00\x00\x00\x00' = OFPTEchoRequest(), echo request ofm = OFPTEchoRequest() raw(ofm) == b'\x04\x02\x00\x08\x00\x00\x00\x00' = OFPMatch(), check padding ofm = OFPMatch(oxm_fields=OFBEthType(eth_type=0x86dd)) assert(len(raw(ofm))%8 == 0) raw(ofm) == b'\x00\x01\x00\x0a\x80\x00\x0a\x02\x86\xdd\x00\x00\x00\x00\x00\x00' = OpenFlow3(), generic method test with OFPTEchoRequest() ofm = OFPTEchoRequest() s = raw(ofm) isinstance(OpenFlow3(s), OFPTEchoRequest) = OFPTFlowMod(), check codes and defaults values ofm = OFPTFlowMod(cmd='OFPFC_DELETE', out_group='ALL', flags='CHECK_OVERLAP+NO_PKT_COUNTS') assert(ofm.cmd == 3) assert(ofm.out_port == 0xffffffff) assert(ofm.out_group == 0xfffffffc) ofm.flags == 10 = OFBIPv6ExtHdrHMID(), check creation of last OXM classes assert(hasattr(OFBIPv6ExtHdr(), 'ipv6_ext_hdr_flags')) OFBIPv6ExtHdrHMID().field == 39 + Complex OFv1.3 messages = OFPTFlowMod(), complex flow_mod mtc = OFPMatch(oxm_fields=OFBVLANVID(vlan_vid=10)) ist1 = OFPITApplyActions(actions=[OFPATSetField(field=OFBIPv4Src(ipv4_src='192.168.10.41')),OFPATSetField(field=OFBEthSrc(eth_src='1a:d5:cb:4e:3c:64')),OFPATOutput(port='NORMAL')]) ist2 = OFPITWriteActions(actions=OFPATOutput(port='CONTROLLER')) ofm = OFPTFlowMod(table_id=2, match=mtc, instructions=[ist1,ist2]) hexdump(ofm) s = b'\x04\x0e\x00\x98\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x01\x00\n\x80\x00\x0c\x02\x00\n\x00\x00\x00\x00\x00\x00\x00\x04\x00@\x00\x00\x00\x00\x00\x19\x00\x18\x80\x00\n\x02\x08\x00\x80\x00\x16\x04\xc0\xa8\n)\x00\x00\x00\x00\x00\x00\x00\x19\x00\x10\x80\x00\x08\x06\x1a\xd5\xcbN