Example #1
0
    def runTest(self):
               
	# Config
        of_ports = pa_port_map.keys()
        of_ports.sort()
        ing_port = of_ports[0]
        egr_port =   of_ports[3]
        
        # Remove flows
        rc = nxm_delete_all_flows()
#        rc = testutils.delete_all_flows(self.controller, pa_logger)
        self.assertEqual(rc, 0, "Failed to delete all flows")

        # Add entry match all 
	#sudo dpctl unix:/tmp/ofd -F nxm flow-mod cmd=add,table=0,idle=100 wildcards=none,in_port=1,hbh_ipv6 apply:output=4

        flow_match = "wildcards=none,in_port=1,rh_ipv6"
        flow_acts = "apply:output=" + str(egr_port)

        rc = nxm_send_flow_mod_add(flow_match,flow_acts,pa_logger)
        self.assertEqual(rc, 0, "Failed to add flow entry")

        #Send packet
	pkt = simple_ipv6_packet(EH = True,  EHpkt = scapy.IPv6ExtHdrRouting()) 

 	print "Sending IPv6 packet to " + str(ing_port)
        pa_logger.info("Sending IPv6 packet to " + str(ing_port))
        pa_logger.debug("Data: " + str(pkt).encode('hex'))
        
	self.dataplane.send(ing_port, str(pkt))


        #Receive packet
        exp_pkt = simple_ipv6_packet(EH = True,  EHpkt = scapy.IPv6ExtHdrRouting()) 

        testutils.receive_pkt_verify(self, egr_port, exp_pkt)

        #See flow match
        request_flow_stats()
        
        #Remove flows
        rc = nxm_delete_all_flows()
#        rc = testutils.delete_all_flows(self.controller, pa_logger)
        self.assertEqual(rc, 0, "Failed to delete all flows")
Example #2
0
    def runTest(self):

        # Config
        of_ports = pa_port_map.keys()
        of_ports.sort()
        ing_port = of_ports[0]
        egr_port =   of_ports[3]
        
        # Remove flows
        rc = testutils.delete_all_flows(self.controller, pa_logger)
        self.assertEqual(rc, 0, "Failed to delete all flows")

	# Add Entry wich matches packets with hbh_code = 0

        flow_match = "wildcards=none,dl_type=0x86DD,rh_ipv6,rh_add_ipv6=ff01::0001"
        flow_acts = "apply:output=" + str(egr_port)

        rc = nxm_send_flow_mod_add(flow_match,flow_acts,pa_logger)
        self.assertEqual(rc, 0, "Failed to add flow entry")

	#Send IPv6 packet with Routing Header

        pkt = simple_ipv6_packet(EH = True,  EHpkt = scapy.IPv6ExtHdrRouting(addresses=['ff01::0001','ff02::0000']))

        pa_logger.info("Sending IPv6 RH packet to " + str(ing_port))
        pa_logger.debug("Data: " + str(pkt).encode('hex'))
        self.dataplane.send(ing_port, str(pkt))
        
        #See flow match
        request_flow_stats()
	
	#Receive packet
        exp_pktv6 = simple_ipv6_packet(EH = True,  EHpkt = scapy.IPv6ExtHdrRouting(addresses=['ff01::0001','ff02::0000'])) 

        testutils.receive_pkt_verify(self, egr_port, exp_pktv6)

        #See flow match
        request_flow_stats()
        
        #Remove flows
        #rc = testutils.delete_all_flows(self.controller, pa_logger)
        rc = nxm_delete_all_flows()
        self.assertEqual(rc, 0, "Failed to delete all flows")
Example #3
0
def getExtHdrs(args):
    ext = None

    # XXX-TODO Try to put them in an order which could make sense
    # in real life packets and according to the RFCs.
    if args.hbh:
        hbh = sp.IPv6ExtHdrHopByHop(options = \
            sp.PadN(optdata="\x00\x00\x00\x00\x00\x00"))
        ext = addExt(ext, hbh)

    if args.rh:
        rh = sp.IPv6ExtHdrRouting(type=0)
        ext = addExt(ext, rh)

    if args.frag6:
        frag6 = sp.IPv6ExtHdrFragment(offset=0, m=0, id=0x1234)
        ext = addExt(ext, frag6)

    if args.esp:
        # XXX TODO
        esp = None
        ext = addExt(ext, esp)

    if args.ah:
        # XXX TODO
        ah = None
        ext = addExt(ext, ah)

    if args.dest:
        dest = sp.IPv6ExtHdrDestOpt(options = \
            sp.PadN(optdata="\x00\x00\x00\x00\x00\x00"))
        ext = addExt(ext, dest)

    if args.mobi:
        # XXX TODO
        mobi = None
        ext = addExt(ext, mobi)

    if args.hip:
        # XXX TODO
        hip = None
        ext = addExt(ext, hip)

    if args.shim6:
        # XXX TODO
        shim6 = None
        ext = addExt(ext, shim6)

    if args.proto253:
        # XXX TODO
        tft = None
        ext = addExt(ext, tft)

    if args.proto254:
        # XXX TODO
        tff = None
        ext = addExt(ext, tff)

    if args.hbhbad:
        hbhbad = sp.IPv6ExtHdrHopByHop(options = \
            sp.PadN(optdata="\x00\x00\x00\x00\x00\x00"))
        ext = addExt(ext, hbhbad)

    return ext