예제 #1
0
    def runTest(self):
        
        of_ports = pa_port_map.keys()
        of_ports.sort()
        ing_port = of_ports[0]
        egr_port = of_ports[3]
        
        # Remove all entries Add entry match all
        rc = dpctl.oxm_delete_all_flows()
        self.assertEqual(rc, 0, "Failed to delete all flows")

        # Add entry match all
        flow_match = "dl_type=0x0800,nw_src=192.168.0.1"
        flow_acts = "apply:output=" + str(egr_port)
        rc = dpctl.oxm_send_flow_mod_add(flow_match,flow_acts,pa_logger)
        self.assertEqual(rc, 0, "Failed to add flow entry")

        #Send packet
        pkt = testutils.simple_tcp_packet()
        pa_logger.info("Sending IPv4 packet to " + str(ing_port))
        pa_logger.debug("Data: " + str(pkt).encode('hex'))
        self.dataplane.send(ing_port, str(pkt))
        
        #Receive packet
        exp_pkt = testutils.simple_tcp_packet()
        testutils.receive_pkt_verify(self, egr_port, exp_pkt)

        #See flow match
        dpctl.request_flow_stats()
        
        #Remove flows
        rc = dpctl.oxm_delete_all_flows()
        self.assertEqual(rc, 0, "Failed to delete all flows")
예제 #2
0
    def runTest(self):

        # Config
        of_ports = pa_port_map.keys()
        of_ports.sort()
        ing_port = of_ports[0]
        egr_port = of_ports[1]
        
        rc = dpctl.oxm_delete_all_flows()
        self.assertEqual(rc, 0, "Failed to delete all flows")

        flow_match = "in_port=" + str(ing_port)
        flow_acts = "apply:output=" + str(egr_port)
        rc = dpctl.oxm_send_flow_mod_add(flow_match,flow_acts,pa_logger)
        self.assertEqual(rc, 0, "Failed to add flow entry")
        
        pkt = testutils.simple_tcp_packet()
        
        pa_logger.info("Sending IPv4 packet to " + str(ing_port))
        pa_logger.debug("Data: " + str(pkt).encode('hex'))

        pkt = testutils.simple_tcp_packet()
        pa_logger.info("Sending IPv4 packet to " + str(ing_port))
        pa_logger.debug("Data: " + str(pkt).encode('hex'))
        self.dataplane.send(ing_port, str(pkt))
        
        exp_pkt = testutils.simple_tcp_packet()
        
        testutils.receive_pkt_verify(self, egr_port, exp_pkt)

        #See flow match
        dpctl.request_flow_stats()
        
        rc = dpctl.oxm_delete_all_flows()
        self.assertEqual(rc, 0, "Failed to delete all flows")
예제 #3
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 = dpctl.oxm_delete_all_flows()
        self.assertEqual(rc, 0, "Failed to delete all flows")

        # Add entry with invalid arguments (wrong dl_type for a IPv4 packet)
        flow_match = "dl_type=0x7000,nw_src=192.168.0.1"
        flow_acts = "apply:output=" + str(egr_port)
        rc = dpctl.oxm_send_flow_mod_add(flow_match,flow_acts,pa_logger)
        self.assertEqual(rc, 0, "Failed to add flow entry")
       
	
        #Send IPv4 packet 

        pkt = testutils.simple_tcp_packet()

        pa_logger.info("Sending IPv4 packet to " + str(ing_port))
        pa_logger.debug("Data: " + str(pkt).encode('hex'))

        pkt = testutils.simple_tcp_packet()
        pa_logger.info("Sending IPv4 packet to " + str(ing_port))
        pa_logger.debug("Data: " + str(pkt).encode('hex'))
        self.dataplane.send(ing_port, str(pkt))
        
        #Should not receive packet
        exp_pkt = testutils.simple_tcp_packet()
	testutils.receive_pkt_check(self.dataplane, exp_pkt, [], of_ports, self,
                              pa_logger)

        #See flow match
        dpctl.request_flow_stats()

        rc = dpctl.oxm_delete_all_flows()
        self.assertEqual(rc, 0, "Failed to delete all flows")
예제 #4
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 = dpctl.oxm_delete_all_flows()
        self.assertEqual(rc, 0, "Failed to delete all flows")

        # Add entry match all 
        flow_match = "in_port=1,tp_src=80"
        flow_acts = "apply:output=" + str(egr_port)

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

        #Send packet
        pkt = dpctl.simple_ipv6_packet(tcp_sport=80, tcp_dport=8080) 

        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 = dpctl.simple_ipv6_packet(tcp_sport=80, tcp_dport=8080) 

        testutils.receive_pkt_verify(self, egr_port, exp_pkt)

        #See flow match
        dpctl.request_flow_stats()
        
        #Remove flows
        rc = dpctl.oxm_delete_all_flows()        
        self.assertEqual(rc, 0, "Failed to delete all flows")