Matteo Scandolo | a229eca | 2017-08-08 13:05:28 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 17 | """
|
| 18 | Flow Test
|
| 19 |
|
| 20 | Test each flow table can set entry, and packet rx correctly.
|
| 21 | """
|
| 22 |
|
| 23 | import logging
|
| 24 |
|
| 25 | from oftest import config
|
| 26 | import oftest.base_tests as base_tests
|
| 27 | import ofp
|
| 28 | from oftest.testutils import *
|
| 29 | from accton_util import *
|
| 30 | import oftest.parse as decode
|
| 31 |
|
| 32 | class VxlanConfigNetconf(base_tests.SimpleDataPlane):
|
| 33 | """
|
| 34 | Verify netconf to configure Vxlan port
|
| 35 | """
|
| 36 | def runTest(self):
|
| 37 | if config["switch_ip"] == None:
|
| 38 | logging.error("Doesn't configure switch IP")
|
| 39 | return
|
| 40 |
|
macauley_cheng | 681958a | 2015-11-11 10:32:05 +0800 | [diff] [blame] | 41 | delete_all_flows(self.controller)
|
| 42 | delete_all_groups(self.controller)
|
| 43 |
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 44 | #paramaters
|
| 45 | access_port_vid=1
|
| 46 | access_phy_port=1
|
| 47 | access_lport=0x10001
|
| 48 | vnid=103
|
| 49 | next_hop_id=1
|
| 50 | next_hop_id_mcast=2
|
| 51 | dst_mac="00:00:11:22:22:11"
|
| 52 | mcast_ipv4="224.1.1.1"
|
| 53 | dst_mac_mcast="01:00:5e:01:01:01"
|
| 54 | network_port_phy_port=2
|
| 55 | network_lport=0x10002
|
| 56 | network_port_vlan=2
|
| 57 | network_port_sip="192.168.1.1"
|
| 58 | network_port_dip="192.168.2.1"
|
| 59 |
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 60 | xml_before=get_edit_config(config["switch_ip"])
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 61 | #get datapath_id from feature message
|
| 62 | feature_reply=get_featureReplay(self)
|
| 63 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 64 | dst_mac=dst_mac_mcast,
|
| 65 | phy_port=network_port_phy_port,
|
| 66 | vlan=network_port_vlan)
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 67 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id_mcast, dst_mac_mcast, network_port_phy_port, network_port_vlan);
|
| 68 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 69 |
|
| 70 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 71 | dst_mac=dst_mac,
|
| 72 | phy_port=network_port_phy_port,
|
| 73 | vlan=network_port_vlan)
|
| 74 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 75 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 76 |
|
| 77 | vni_config_xml=get_vni_config_xml(vni_id=vnid,
|
| 78 | mcast_ipv4=mcast_ipv4,
|
| 79 | next_hop_id=next_hop_id_mcast)
|
| 80 | logging.info("config VNI %lx", vnid);
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 81 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 82 |
|
| 83 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 84 | lport=access_lport, phy_port=access_phy_port,
|
| 85 | vlan=access_port_vid, vnid=vnid)
|
| 86 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport, access_phy_port, access_port_vid, vnid);
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 87 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 88 |
|
| 89 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 90 | lport=network_lport,
|
| 91 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 92 | next_hop_id=next_hop_id,
|
| 93 | vnid=vnid)
|
| 94 | logging.info("config VTEP 0x%lx, SRC_IP %s, DST_IP %s, NEXTHOP_ID %d", network_lport, network_port_sip, network_port_dip, next_hop_id);
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 95 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 96 |
|
| 97 | get_edit_config(config["switch_ip"])
|
| 98 |
|
| 99 | #exit verification so clear all configuration
|
| 100 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 101 | lport=access_lport, phy_port=access_phy_port,
|
| 102 | vlan=access_port_vid, vnid=vnid, operation="delete")
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 103 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 104 |
|
| 105 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 106 | lport=network_lport,
|
| 107 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 108 | next_hop_id=next_hop_id,
|
| 109 | vnid=vnid, operation="delete")
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 110 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 111 |
|
| 112 | vni_config_xml=get_vni_config_xml(vni_id=vnid,
|
| 113 | mcast_ipv4=mcast_ipv4,
|
| 114 | next_hop_id=next_hop_id_mcast, operation="delete")
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 115 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 116 |
|
| 117 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 118 | dst_mac=dst_mac,
|
| 119 | phy_port=network_port_phy_port,
|
| 120 | vlan=network_port_vlan, operation="delete")
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 121 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 122 |
|
| 123 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 124 | dst_mac=dst_mac_mcast,
|
| 125 | phy_port=network_port_phy_port,
|
| 126 | vlan=network_port_vlan, operation="delete")
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 127 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 128 |
|
macauley | 6f6ceb2 | 2015-08-07 09:37:12 +0800 | [diff] [blame] | 129 | xml_after=get_edit_config(config["switch_ip"])
|
macauley_cheng | 681958a | 2015-11-11 10:32:05 +0800 | [diff] [blame] | 130 | #logging.info("xml_before\n %s", xml_before)
|
| 131 | #logging.info("xml_after\n %s", xml_after)
|
| 132 | #netopeer may have problem on xml process
|
| 133 | #assert(xml_before == xml_after)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 134 |
|
| 135 | class OverlayFloodGroup(base_tests.SimpleDataPlane):
|
| 136 | """
|
| 137 | create two lport
|
| 138 | """
|
| 139 | def runTest(self):
|
| 140 | """
|
| 141 | first verify flood over unicast,
|
| 142 | second verify flood over mcast
|
| 143 | """
|
| 144 | if config["switch_ip"] == None:
|
| 145 | logging.error("Doesn't configure switch IP")
|
| 146 | return
|
| 147 |
|
| 148 | delete_all_flows(self.controller)
|
| 149 | delete_all_groups(self.controller)
|
| 150 | #paramaters
|
| 151 | access_port_vid=1
|
| 152 | access_phy_port=1
|
| 153 | access_lport=0x10001
|
| 154 | vnid=103
|
| 155 | next_hop_id=1
|
| 156 | next_hop_id_mcast=2
|
| 157 | dst_mac="00:00:11:22:22:11"
|
| 158 | mcast_ipv4="224.1.1.1"
|
| 159 | dst_mac_mcast="01:00:5e:01:01:01"
|
| 160 | network_port_phy_port=2
|
| 161 | network_lport=0x10002
|
| 162 | network_port_vlan=2
|
| 163 | network_port_sip="192.168.1.1"
|
| 164 | network_port_dip="192.168.2.1"
|
| 165 |
|
| 166 | feature_reply=get_featureReplay(self)
|
| 167 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 168 | dst_mac=dst_mac_mcast,
|
| 169 | phy_port=network_port_phy_port,
|
| 170 | vlan=network_port_vlan)
|
| 171 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
| 172 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 173 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=mcast_ipv4, next_hop_id=next_hop_id_mcast)
|
| 174 | logging.info("config VNI %lx", vnid);
|
| 175 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 176 |
|
| 177 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 178 | lport=access_lport, phy_port=access_phy_port,
|
| 179 | vlan=access_port_vid, vnid=vnid)
|
| 180 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport, access_phy_port, access_port_vid, vnid);
|
| 181 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 182 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 183 | dst_mac=dst_mac,
|
| 184 | phy_port=network_port_phy_port,
|
| 185 | vlan=network_port_vlan)
|
| 186 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
| 187 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 188 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 189 | lport=network_lport,
|
| 190 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 191 | next_hop_id=next_hop_id,
|
| 192 | vnid=vnid)
|
| 193 | logging.info("config VTEP 0x%lx, SRC_IP %s, DST_IP %s, NEXTHOP_ID %d", network_lport, network_port_sip, network_port_dip, next_hop_id);
|
| 194 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 195 |
|
| 196 | #add flow over unicast group
|
| 197 | msg=add_l2_overlay_flood_over_unicast_tunnel_group(self.controller, vnid, [access_lport, network_lport], 1)
|
| 198 | #verify
|
| 199 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 200 | verify_group_stats=(ofp.group_desc_stats_entry(
|
| 201 | group_type=msg.group_type,
|
| 202 | group_id=msg.group_id,
|
| 203 | buckets=msg.buckets))
|
| 204 |
|
| 205 | self.assertEquals(stats, [verify_group_stats])
|
| 206 | #clear all group
|
| 207 | delete_all_groups(self.controller)
|
| 208 | #
|
| 209 | #flood over mcast
|
| 210 | msg=add_l2_overlay_flood_over_mcast_tunnel_group(self.controller, vnid, [access_lport, network_lport], 1)
|
| 211 |
|
| 212 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 213 |
|
| 214 | verify_group_stats=(ofp.group_desc_stats_entry(
|
| 215 | group_type=msg.group_type,
|
| 216 | group_id=msg.group_id,
|
| 217 | buckets=msg.buckets))
|
| 218 |
|
| 219 | self.assertEquals(stats, [verify_group_stats])
|
| 220 | #clear all group
|
| 221 | delete_all_groups(self.controller)
|
| 222 | #exit verification so clear all configuration
|
| 223 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 224 | lport=access_lport, phy_port=access_phy_port,
|
| 225 | vlan=access_port_vid, vnid=vnid, operation="delete")
|
| 226 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 227 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 228 | lport=network_lport,
|
| 229 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 230 | next_hop_id=next_hop_id,
|
| 231 | vnid=vnid, operation="delete")
|
| 232 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 233 |
|
| 234 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=None, next_hop_id=None, operation="delete")
|
| 235 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 236 |
|
| 237 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 238 | dst_mac=dst_mac,
|
| 239 | phy_port=network_port_phy_port,
|
| 240 | vlan=network_port_vlan, operation="delete")
|
| 241 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 242 |
|
| 243 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 244 | dst_mac=dst_mac_mcast,
|
| 245 | phy_port=network_port_phy_port,
|
| 246 | vlan=network_port_vlan, operation="delete")
|
| 247 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 248 |
|
| 249 | class OverlayMcastGroup(base_tests.SimpleDataPlane):
|
| 250 | """
|
| 251 | create two lport
|
| 252 | """
|
| 253 | def runTest(self):
|
| 254 | if config["switch_ip"] == None:
|
| 255 | logging.error("Doesn't configure switch IP")
|
| 256 | return
|
| 257 |
|
| 258 | delete_all_flows(self.controller)
|
| 259 | delete_all_groups(self.controller)
|
| 260 | #paramaters
|
| 261 | access_port_vid=1
|
| 262 | access_phy_port=1
|
| 263 | access_lport=0x10001
|
| 264 | vnid=103
|
| 265 | next_hop_id=1
|
| 266 | next_hop_id_mcast=2
|
| 267 | dst_mac="00:00:11:22:22:11"
|
| 268 | mcast_ipv4="224.1.1.1"
|
| 269 | dst_mac_mcast="01:00:5e:01:01:01"
|
| 270 | network_port_phy_port=2
|
| 271 | network_lport=0x10002
|
| 272 | network_port_vlan=2
|
| 273 | network_port_sip="192.168.1.1"
|
| 274 | network_port_dip="192.168.2.1"
|
| 275 |
|
| 276 | feature_reply=get_featureReplay(self)
|
| 277 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 278 | dst_mac=dst_mac_mcast,
|
| 279 | phy_port=network_port_phy_port,
|
| 280 | vlan=network_port_vlan)
|
| 281 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
| 282 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 283 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=mcast_ipv4, next_hop_id=next_hop_id_mcast)
|
| 284 | logging.info("config VNI %lx", vnid);
|
| 285 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 286 |
|
| 287 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 288 | lport=access_lport, phy_port=access_phy_port,
|
| 289 | vlan=access_port_vid, vnid=vnid)
|
| 290 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport, access_phy_port, access_port_vid, vnid);
|
| 291 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 292 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 293 | dst_mac=dst_mac,
|
| 294 | phy_port=network_port_phy_port,
|
| 295 | vlan=network_port_vlan)
|
| 296 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
| 297 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 298 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 299 | lport=network_lport,
|
| 300 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 301 | next_hop_id=next_hop_id,
|
| 302 | vnid=vnid)
|
| 303 | logging.info("config VTEP 0x%lx, SRC_IP %s, DST_IP %s, NEXTHOP_ID %d", network_lport, network_port_sip, network_port_dip, next_hop_id);
|
| 304 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 305 |
|
| 306 | #add flow over unicast group
|
| 307 | msg=msg=add_l2_overlay_mcast_over_unicast_tunnel_group(self.controller, vnid, [access_lport, network_lport], 1)
|
| 308 | #verify
|
| 309 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 310 | verify_group_stats=(ofp.group_desc_stats_entry(
|
| 311 | group_type=msg.group_type,
|
| 312 | group_id=msg.group_id,
|
| 313 | buckets=msg.buckets))
|
| 314 |
|
| 315 | self.assertEquals(stats, [verify_group_stats])
|
| 316 | #clear all group
|
| 317 | delete_all_groups(self.controller)
|
| 318 | #
|
| 319 | #flood over mcast
|
| 320 | msg=add_l2_overlay_mcast_over_mcast_tunnel_group(self.controller, vnid, [access_lport, network_lport], 1)
|
| 321 |
|
| 322 | stats = get_stats(self, ofp.message.group_desc_stats_request())
|
| 323 |
|
| 324 | verify_group_stats=(ofp.group_desc_stats_entry(
|
| 325 | group_type=msg.group_type,
|
| 326 | group_id=msg.group_id,
|
| 327 | buckets=msg.buckets))
|
| 328 |
|
| 329 | self.assertEquals(stats, [verify_group_stats])
|
| 330 | #clear all group
|
| 331 | delete_all_groups(self.controller)
|
| 332 | #exit verification so clear all configuration
|
| 333 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 334 | lport=access_lport, phy_port=access_phy_port,
|
| 335 | vlan=access_port_vid, vnid=vnid, operation="delete")
|
| 336 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 337 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 338 | lport=network_lport,
|
| 339 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 340 | next_hop_id=next_hop_id,
|
| 341 | vnid=vnid, operation="delete")
|
| 342 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 343 |
|
| 344 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=None, next_hop_id=None, operation="delete")
|
| 345 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 346 |
|
| 347 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 348 | dst_mac=dst_mac,
|
| 349 | phy_port=network_port_phy_port,
|
| 350 | vlan=network_port_vlan, operation="delete")
|
| 351 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 352 |
|
| 353 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 354 | dst_mac=dst_mac_mcast,
|
| 355 | phy_port=network_port_phy_port,
|
| 356 | vlan=network_port_vlan, operation="delete")
|
| 357 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 358 |
|
| 359 | class AccessToNetworkDLFMcast(base_tests.SimpleDataPlane):
|
| 360 | def runTest(self):
|
| 361 | """
|
| 362 | first verify flood over unicast,
|
| 363 | second verify flood over mcast
|
| 364 | """
|
| 365 | if config["switch_ip"] == None:
|
| 366 | logging.error("Doesn't configure switch IP")
|
| 367 | return
|
| 368 |
|
| 369 | delete_all_flows(self.controller)
|
| 370 | delete_all_groups(self.controller)
|
| 371 |
|
| 372 | access_port1_vid=1
|
| 373 | access_phy_port1=config["port_map"].keys()[0]
|
| 374 | access_lport1=0x10001
|
| 375 | access_port2_vid=0
|
| 376 | access_phy_port2=config["port_map"].keys()[1]
|
| 377 | access_lport2=0x10002
|
| 378 | vnid=10
|
| 379 | next_hop_id=1
|
| 380 | next_hop_id_mcast=2
|
| 381 | dst_mac="00:00:11:22:22:11"
|
| 382 | mcast_ipv4="224.1.1.1"
|
| 383 | dst_mac_mcast="01:00:5e:01:01:01"
|
| 384 | network_port_phy_port=config["port_map"].keys()[2]
|
| 385 | network_lport=0x10003
|
| 386 | network_port_vlan=2
|
| 387 | network_port_sip="192.168.1.1"
|
| 388 | network_port_dip="192.168.2.1"
|
| 389 |
|
| 390 | feature_reply=get_featureReplay(self)
|
| 391 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 392 | dst_mac=dst_mac,
|
| 393 | phy_port=network_port_phy_port,
|
| 394 | vlan=network_port_vlan)
|
| 395 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
| 396 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 397 |
|
| 398 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 399 | dst_mac=dst_mac_mcast,
|
| 400 | phy_port=network_port_phy_port,
|
| 401 | vlan=network_port_vlan)
|
| 402 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
| 403 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 404 |
|
| 405 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=mcast_ipv4, next_hop_id=next_hop_id_mcast)
|
| 406 | logging.info("config VNI %lx", vnid);
|
| 407 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 408 |
|
| 409 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 410 | lport=access_lport1, phy_port=access_phy_port1,
|
| 411 | vlan=access_port1_vid, vnid=vnid)
|
| 412 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport1, access_phy_port1, access_port1_vid, vnid);
|
| 413 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 414 |
|
| 415 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 416 | lport=access_lport2, phy_port=access_phy_port2,
|
| 417 | vlan=access_port2_vid, vnid=vnid)
|
| 418 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport2, access_phy_port2, access_port2_vid, vnid);
|
| 419 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 420 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 421 | lport=network_lport,
|
| 422 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 423 | next_hop_id=next_hop_id,
|
| 424 | vnid=vnid)
|
| 425 | logging.info("config VTEP 0x%lx, SRC_IP %s, DST_IP %s, NEXTHOP_ID %d", network_lport, network_port_sip, network_port_dip, next_hop_id);
|
| 426 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 427 |
|
| 428 | #get_edit_config(config["switch_ip"])
|
| 429 |
|
| 430 | #add port table to have vxlan ability
|
| 431 | add_port_table_flow(self.controller)
|
| 432 |
|
| 433 | #for network port need l2 interface group to decide vlan tag or not
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 434 | add_one_l2_interface_group(self.controller, network_port_phy_port, vlan_id=network_port_vlan)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 435 |
|
| 436 | #add DLF bridge flow
|
| 437 | msg=add_l2_overlay_flood_over_mcast_tunnel_group(self.controller, vnid, [access_lport1, access_lport2, network_lport], 1)
|
| 438 | add_overlay_bridge_flow(self.controller, None, vnid, msg.group_id, True, True)
|
| 439 |
|
| 440 | #send packet on access port
|
| 441 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:00:11:11:11:11',
|
| 442 | dl_vlan_enable= True,
|
| 443 | vlan_vid=access_port1_vid)
|
| 444 | pkt = str(parsed_pkt)
|
| 445 | self.dataplane.send(access_phy_port1, pkt)
|
| 446 |
|
| 447 | #verify packet on access port
|
| 448 | parsed_pkt = simple_udp_packet(pktlen=92, eth_dst='00:00:11:11:11:11')
|
| 449 | pkt = str(parsed_pkt)
|
| 450 | verify_packet(self, pkt, access_phy_port2)
|
| 451 | #vxlan packet IP header have some parmater decide by HW,
|
| 452 | #we can easy to check VxLAN IP header
|
| 453 | verify_packet(self, pkt, network_port_phy_port)
|
| 454 | verify_no_other_packets(self)
|
| 455 |
|
| 456 | add_overlay_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, 0x9a], vnid, network_lport, False, True)
|
| 457 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:9a',
|
| 458 | dl_vlan_enable= True,
|
| 459 | vlan_vid=access_port1_vid)
|
| 460 | pkt = str(parsed_pkt)
|
| 461 | self.dataplane.send(access_phy_port1, pkt)
|
| 462 | #verify packet on network port
|
| 463 | parsed_pkt = simple_udp_packet(pktlen=92, eth_dst='00:12:34:56:78:9a')
|
| 464 | pkt = str(parsed_pkt)
|
| 465 | verify_packet(self, pkt, network_port_phy_port)
|
| 466 | verify_no_other_packets(self)
|
| 467 |
|
| 468 | #exit verification so clear all configuration
|
| 469 | delete_all_flows(self.controller)
|
| 470 | delete_all_groups(self.controller)
|
| 471 |
|
| 472 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 473 | lport=access_lport1, phy_port=access_phy_port1,
|
| 474 | vlan=access_port1_vid, vnid=vnid, operation="delete")
|
| 475 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 476 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 477 | lport=access_lport2, phy_port=access_phy_port2,
|
| 478 | vlan=access_port2_vid, vnid=vnid, operation="delete")
|
| 479 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 480 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 481 | lport=network_lport,
|
| 482 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 483 | next_hop_id=next_hop_id,
|
| 484 | vnid=vnid, operation="delete")
|
| 485 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 486 |
|
| 487 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=None, next_hop_id=None, operation="delete")
|
| 488 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 489 |
|
| 490 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 491 | dst_mac=dst_mac,
|
| 492 | phy_port=network_port_phy_port,
|
| 493 | vlan=network_port_vlan, operation="delete")
|
| 494 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 495 |
|
| 496 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 497 | dst_mac=dst_mac_mcast,
|
| 498 | phy_port=network_port_phy_port,
|
| 499 | vlan=network_port_vlan, operation="delete")
|
| 500 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 501 |
|
| 502 | class AccessToNetworkDLFUcast(base_tests.SimpleDataPlane):
|
| 503 | def runTest(self):
|
| 504 | """
|
| 505 | first verify flood over unicast,
|
| 506 | second verify flood over mcast
|
| 507 | """
|
| 508 | if config["switch_ip"] == None:
|
| 509 | logging.error("Doesn't configure switch IP")
|
| 510 | return
|
| 511 |
|
| 512 | delete_all_flows(self.controller)
|
| 513 | delete_all_groups(self.controller)
|
| 514 |
|
| 515 | access_port1_vid=1
|
| 516 | access_phy_port1=config["port_map"].keys()[0]
|
| 517 | access_lport1=0x10001
|
| 518 | access_port2_vid=0
|
| 519 | access_phy_port2=config["port_map"].keys()[1]
|
| 520 | access_lport2=0x10002
|
| 521 | vnid=10
|
| 522 | next_hop_id=1
|
| 523 | next_hop_id_mcast=2
|
| 524 | dst_mac="00:00:11:22:22:11"
|
| 525 | mcast_ipv4="224.1.1.1"
|
| 526 | dst_mac_mcast="01:00:5e:01:01:01"
|
| 527 | network_port_phy_port=config["port_map"].keys()[2]
|
| 528 | network_lport=0x10003
|
| 529 | network_port_vlan=2
|
| 530 | network_port_sip="192.168.1.1"
|
| 531 | network_port_dip="192.168.2.1"
|
| 532 |
|
| 533 | feature_reply=get_featureReplay(self)
|
| 534 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 535 | dst_mac=dst_mac,
|
| 536 | phy_port=network_port_phy_port,
|
| 537 | vlan=network_port_vlan)
|
| 538 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
| 539 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 540 |
|
| 541 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 542 | dst_mac=dst_mac_mcast,
|
| 543 | phy_port=network_port_phy_port,
|
| 544 | vlan=network_port_vlan)
|
| 545 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
| 546 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 547 |
|
| 548 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=mcast_ipv4, next_hop_id=next_hop_id_mcast)
|
| 549 | logging.info("config VNI %lx", vnid);
|
| 550 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 551 |
|
| 552 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 553 | lport=access_lport1, phy_port=access_phy_port1,
|
| 554 | vlan=access_port1_vid, vnid=vnid)
|
| 555 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport1, access_phy_port1, access_port1_vid, vnid);
|
| 556 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 557 |
|
| 558 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 559 | lport=access_lport2, phy_port=access_phy_port2,
|
| 560 | vlan=access_port2_vid, vnid=vnid)
|
| 561 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport2, access_phy_port2, access_port2_vid, vnid);
|
| 562 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 563 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 564 | lport=network_lport,
|
| 565 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 566 | next_hop_id=next_hop_id,
|
| 567 | vnid=vnid)
|
| 568 | logging.info("config VTEP 0x%lx, SRC_IP %s, DST_IP %s, NEXTHOP_ID %d", network_lport, network_port_sip, network_port_dip, next_hop_id);
|
| 569 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 570 |
|
| 571 | #get_edit_config(config["switch_ip"])
|
| 572 |
|
| 573 | #add port table to have vxlan ability
|
| 574 | add_port_table_flow(self.controller)
|
| 575 |
|
| 576 | #for network port need l2 interface group to decide vlan tag or not
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 577 | add_one_l2_interface_group(self.controller, network_port_phy_port, vlan_id=network_port_vlan)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 578 |
|
| 579 | #add DLF bridge flow
|
| 580 | msg=add_l2_overlay_flood_over_unicast_tunnel_group(self.controller, vnid, [access_lport1, access_lport2, network_lport], 1)
|
| 581 | add_overlay_bridge_flow(self.controller, None, vnid, msg.group_id, True, True)
|
| 582 |
|
| 583 | #send packet on access port
|
| 584 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:00:11:11:11:11',
|
| 585 | dl_vlan_enable= True,
|
| 586 | vlan_vid=access_port1_vid)
|
| 587 | pkt = str(parsed_pkt)
|
| 588 | self.dataplane.send(access_phy_port1, pkt)
|
| 589 |
|
| 590 | #verify packet on access port
|
| 591 | parsed_pkt = simple_udp_packet(pktlen=92, eth_dst='00:00:11:11:11:11')
|
| 592 | pkt = str(parsed_pkt)
|
| 593 | verify_packet(self, pkt, access_phy_port2)
|
| 594 | #vxlan packet IP header have some parmater decide by HW,
|
| 595 | #we can easy to check VxLAN IP header
|
| 596 | verify_packet(self, pkt, network_port_phy_port)
|
| 597 | verify_no_other_packets(self)
|
| 598 |
|
| 599 | add_overlay_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, 0x9a], vnid, network_lport, False, True)
|
| 600 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:9a',
|
| 601 | dl_vlan_enable= True,
|
| 602 | vlan_vid=access_port1_vid)
|
| 603 | pkt = str(parsed_pkt)
|
| 604 | self.dataplane.send(access_phy_port1, pkt)
|
| 605 | #verify packet on network port
|
| 606 | parsed_pkt = simple_udp_packet(pktlen=92, eth_dst='00:12:34:56:78:9a')
|
| 607 | pkt = str(parsed_pkt)
|
| 608 | verify_packet(self, pkt, network_port_phy_port)
|
| 609 | verify_no_other_packets(self)
|
| 610 |
|
| 611 | #exit verification so clear all configuration
|
| 612 | delete_all_flows(self.controller)
|
| 613 | delete_all_groups(self.controller)
|
| 614 |
|
| 615 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 616 | lport=access_lport1, phy_port=access_phy_port1,
|
| 617 | vlan=access_port1_vid, vnid=vnid, operation="delete")
|
| 618 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 619 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 620 | lport=access_lport2, phy_port=access_phy_port2,
|
| 621 | vlan=access_port2_vid, vnid=vnid, operation="delete")
|
| 622 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 623 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 624 | lport=network_lport,
|
| 625 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 626 | next_hop_id=next_hop_id,
|
| 627 | vnid=vnid, operation="delete")
|
| 628 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 629 |
|
| 630 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=None, next_hop_id=None, operation="delete")
|
| 631 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 632 |
|
| 633 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 634 | dst_mac=dst_mac,
|
| 635 | phy_port=network_port_phy_port,
|
| 636 | vlan=network_port_vlan, operation="delete")
|
| 637 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 638 |
|
| 639 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 640 | dst_mac=dst_mac_mcast,
|
| 641 | phy_port=network_port_phy_port,
|
| 642 | vlan=network_port_vlan, operation="delete")
|
| 643 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 644 |
|
macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 645 | class AccessWithAccessDiffPortVlan(base_tests.SimpleDataPlane):
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 646 | def runTest(self):
|
| 647 | """
|
| 648 | first verify flood over unicast,
|
| 649 | second verify flood over mcast
|
| 650 | """
|
| 651 | if config["switch_ip"] == None:
|
| 652 | logging.error("Doesn't configure switch IP")
|
| 653 | return
|
| 654 |
|
| 655 | delete_all_flows(self.controller)
|
| 656 | delete_all_groups(self.controller)
|
| 657 |
|
| 658 | access_port1_vid=1
|
| 659 | access_phy_port1=config["port_map"].keys()[0]
|
| 660 | access_lport1=0x10001
|
| 661 | access_port2_vid=0
|
| 662 | access_phy_port2=config["port_map"].keys()[1]
|
| 663 | access_lport2=0x10002
|
| 664 | access_port3_vid=3
|
| 665 | access_phy_port3=config["port_map"].keys()[2]
|
| 666 | access_lport3=0x10003
|
| 667 | vnid=10
|
| 668 | next_hop_id_mcast=1
|
| 669 | mcast_ipv4="224.1.1.1"
|
| 670 | dst_mac_mcast="01:00:5e:01:01:01"
|
| 671 |
|
| 672 | feature_reply=get_featureReplay(self)
|
| 673 |
|
| 674 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 675 | dst_mac=dst_mac_mcast,
|
| 676 | phy_port=access_phy_port3,
|
| 677 | vlan=access_port3_vid)
|
| 678 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id_mcast, dst_mac_mcast, access_phy_port3, access_port3_vid);
|
| 679 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 680 |
|
| 681 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=mcast_ipv4, next_hop_id=next_hop_id_mcast)
|
| 682 | logging.info("config VNI %lx", vnid);
|
| 683 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 684 |
|
| 685 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 686 | lport=access_lport1, phy_port=access_phy_port1,
|
| 687 | vlan=access_port1_vid, vnid=vnid)
|
| 688 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport1, access_phy_port1, access_port1_vid, vnid);
|
| 689 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 690 |
|
| 691 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 692 | lport=access_lport2, phy_port=access_phy_port2,
|
| 693 | vlan=access_port2_vid, vnid=vnid)
|
| 694 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport2, access_phy_port2, access_port2_vid, vnid);
|
| 695 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 696 |
|
| 697 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 698 | lport=access_lport3, phy_port=access_phy_port3,
|
| 699 | vlan=access_port3_vid, vnid=vnid)
|
| 700 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport3, access_phy_port3, access_port3_vid, vnid);
|
| 701 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 702 |
|
| 703 |
|
| 704 | #add port table to have vxlan ability
|
| 705 | add_port_table_flow(self.controller)
|
| 706 |
|
| 707 | #add DLF bridge flow
|
| 708 | msg=add_l2_overlay_flood_over_mcast_tunnel_group(self.controller, vnid, [access_lport1, access_lport2, access_lport3], 1)
|
| 709 | add_overlay_bridge_flow(self.controller, None, vnid, msg.group_id, True, True)
|
| 710 |
|
| 711 | #send packet on access port
|
| 712 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:00:11:11:11:11',
|
| 713 | dl_vlan_enable= True,
|
| 714 | vlan_vid=access_port1_vid)
|
| 715 | pkt = str(parsed_pkt)
|
| 716 | self.dataplane.send(access_phy_port1, pkt)
|
| 717 |
|
| 718 | #verify packet on access port 2, vid=0, so untag
|
| 719 | parsed_pkt = simple_udp_packet(pktlen=92, eth_dst='00:00:11:11:11:11')
|
| 720 | pkt = str(parsed_pkt)
|
| 721 | verify_packet(self, pkt, access_phy_port2)
|
| 722 | #verify packet on access port 3
|
| 723 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:00:11:11:11:11',
|
| 724 | dl_vlan_enable= True,
|
| 725 | vlan_vid=access_port3_vid)
|
| 726 | pkt = str(parsed_pkt)
|
| 727 | verify_packet(self, pkt, access_phy_port3)
|
| 728 | verify_no_other_packets(self)
|
| 729 |
|
| 730 | add_overlay_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, 0x9a], vnid, access_lport2, False, True)
|
| 731 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:9a',
|
| 732 | dl_vlan_enable= True,
|
| 733 | vlan_vid=access_port1_vid)
|
| 734 | pkt = str(parsed_pkt)
|
| 735 | self.dataplane.send(access_phy_port1, pkt)
|
| 736 | #verify packet on access port
|
| 737 | parsed_pkt = simple_udp_packet(pktlen=92, eth_dst='00:12:34:56:78:9a')
|
| 738 | pkt = str(parsed_pkt)
|
| 739 | verify_packet(self, pkt, access_phy_port2)
|
| 740 | verify_no_other_packets(self)
|
| 741 |
|
| 742 |
|
| 743 | add_overlay_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, 0xaa], vnid, access_lport3, False, True)
|
| 744 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:aa',
|
| 745 | dl_vlan_enable= True,
|
| 746 | vlan_vid=access_port1_vid)
|
| 747 | pkt = str(parsed_pkt)
|
| 748 | self.dataplane.send(access_phy_port1, pkt)
|
| 749 | #verify packet on access port
|
| 750 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:aa',
|
| 751 | dl_vlan_enable= True,
|
| 752 | vlan_vid=access_port3_vid)
|
| 753 | pkt = str(parsed_pkt)
|
| 754 | verify_packet(self, pkt, access_phy_port3)
|
| 755 | verify_no_other_packets(self)
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 | #exit verification so clear all configuration
|
| 760 | delete_all_flows(self.controller)
|
| 761 | delete_all_groups(self.controller)
|
| 762 |
|
| 763 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 764 | lport=access_lport1, phy_port=access_phy_port1,
|
| 765 | vlan=access_port1_vid, vnid=vnid, operation="delete")
|
| 766 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 767 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 768 | lport=access_lport2, phy_port=access_phy_port2,
|
| 769 | vlan=access_port2_vid, vnid=vnid, operation="delete")
|
| 770 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 771 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 772 | lport=access_lport3, phy_port=access_phy_port3,
|
| 773 | vlan=access_port3_vid, vnid=vnid, operation="delete")
|
| 774 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport3, access_phy_port3, access_port3_vid, vnid);
|
| 775 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 776 |
|
| 777 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=None, next_hop_id=None, operation="delete")
|
| 778 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 779 |
|
| 780 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 781 | dst_mac=dst_mac_mcast,
|
| 782 | phy_port=access_phy_port3,
|
| 783 | vlan=access_port3_vid, operation="delete")
|
| 784 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 785 |
|
macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 786 |
|
| 787 | class AccessWithAccessSamePortDiffVlan(base_tests.SimpleDataPlane):
|
| 788 | def runTest(self):
|
| 789 | """
|
| 790 | first verify flood over unicast,
|
| 791 | second verify flood over mcast
|
| 792 | """
|
| 793 | if config["switch_ip"] == None:
|
| 794 | logging.error("Doesn't configure switch IP")
|
| 795 | return
|
| 796 |
|
| 797 | delete_all_flows(self.controller)
|
| 798 | delete_all_groups(self.controller)
|
| 799 |
|
| 800 | access_port1_vid=1
|
| 801 | access_phy_port1=config["port_map"].keys()[0]
|
| 802 | access_lport1=0x10001
|
macauley_cheng | 681958a | 2015-11-11 10:32:05 +0800 | [diff] [blame] | 803 | access_port2_vid=2
|
macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 804 | access_phy_port2= access_phy_port1
|
| 805 | access_lport2=0x10002
|
| 806 | access_port3_vid=3
|
| 807 | access_phy_port3=access_phy_port1
|
| 808 | access_lport3=0x10003
|
| 809 | vnid=10
|
| 810 | next_hop_id_mcast=1
|
| 811 | mcast_ipv4="224.1.1.1"
|
| 812 | dst_mac_mcast="01:00:5e:01:01:01"
|
| 813 |
|
| 814 | feature_reply=get_featureReplay(self)
|
| 815 |
|
| 816 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 817 | dst_mac=dst_mac_mcast,
|
| 818 | phy_port=access_phy_port3,
|
| 819 | vlan=access_port3_vid)
|
| 820 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id_mcast, dst_mac_mcast, access_phy_port3, access_port3_vid);
|
| 821 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 822 |
|
| 823 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=mcast_ipv4, next_hop_id=next_hop_id_mcast)
|
| 824 | logging.info("config VNI %lx", vnid);
|
| 825 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 826 |
|
| 827 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 828 | lport=access_lport1, phy_port=access_phy_port1,
|
| 829 | vlan=access_port1_vid, vnid=vnid)
|
| 830 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport1, access_phy_port1, access_port1_vid, vnid);
|
| 831 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 832 |
|
| 833 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 834 | lport=access_lport2, phy_port=access_phy_port2,
|
| 835 | vlan=access_port2_vid, vnid=vnid)
|
| 836 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport2, access_phy_port2, access_port2_vid, vnid);
|
| 837 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 838 |
|
| 839 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 840 | lport=access_lport3, phy_port=access_phy_port3,
|
| 841 | vlan=access_port3_vid, vnid=vnid)
|
| 842 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport3, access_phy_port3, access_port3_vid, vnid);
|
| 843 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 844 |
|
| 845 |
|
| 846 | #add port table to have vxlan ability
|
| 847 | add_port_table_flow(self.controller)
|
| 848 |
|
| 849 | #add DLF bridge flow
|
| 850 | msg=add_l2_overlay_flood_over_mcast_tunnel_group(self.controller, vnid, [access_lport1, access_lport2, access_lport3], 1)
|
| 851 | add_overlay_bridge_flow(self.controller, None, vnid, msg.group_id, True, True)
|
| 852 |
|
| 853 | #send packet on access port
|
| 854 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:00:11:11:11:11',
|
| 855 | dl_vlan_enable= True,
|
| 856 | vlan_vid=access_port1_vid)
|
| 857 | pkt = str(parsed_pkt)
|
| 858 | self.dataplane.send(access_phy_port1, pkt)
|
| 859 |
|
| 860 | #verify packet on access port 2, vid=0, so untag
|
macauley_cheng | 681958a | 2015-11-11 10:32:05 +0800 | [diff] [blame] | 861 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:00:11:11:11:11',
|
| 862 | dl_vlan_enable = True,
|
| 863 | vlan_vid = access_port2_vid)
|
macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 864 | pkt = str(parsed_pkt)
|
| 865 | verify_packet(self, pkt, access_phy_port2)
|
| 866 | #verify packet on access port 3
|
| 867 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:00:11:11:11:11',
|
| 868 | dl_vlan_enable= True,
|
| 869 | vlan_vid=access_port3_vid)
|
| 870 | pkt = str(parsed_pkt)
|
| 871 | verify_packet(self, pkt, access_phy_port3)
|
| 872 | verify_no_other_packets(self)
|
| 873 |
|
| 874 | add_overlay_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, 0x9a], vnid, access_lport2, False, True)
|
| 875 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:9a',
|
| 876 | dl_vlan_enable= True,
|
| 877 | vlan_vid=access_port1_vid)
|
| 878 | pkt = str(parsed_pkt)
|
| 879 | self.dataplane.send(access_phy_port1, pkt)
|
| 880 | #verify packet on access port
|
macauley_cheng | 681958a | 2015-11-11 10:32:05 +0800 | [diff] [blame] | 881 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:9a',
|
| 882 | dl_vlan_enable = True,
|
| 883 | vlan_vid = access_port2_vid)
|
macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 884 | pkt = str(parsed_pkt)
|
| 885 | verify_packet(self, pkt, access_phy_port2)
|
| 886 | verify_no_other_packets(self)
|
| 887 |
|
| 888 |
|
| 889 | add_overlay_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, 0xaa], vnid, access_lport3, False, True)
|
| 890 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:aa',
|
| 891 | dl_vlan_enable= True,
|
| 892 | vlan_vid=access_port1_vid)
|
| 893 | pkt = str(parsed_pkt)
|
| 894 | self.dataplane.send(access_phy_port1, pkt)
|
| 895 | #verify packet on access port
|
| 896 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:aa',
|
| 897 | dl_vlan_enable= True,
|
| 898 | vlan_vid=access_port3_vid)
|
| 899 | pkt = str(parsed_pkt)
|
| 900 | verify_packet(self, pkt, access_phy_port3)
|
| 901 | verify_no_other_packets(self)
|
| 902 |
|
| 903 | add_overlay_bridge_flow(self.controller, [0x00, 0x12, 0x34, 0x56, 0x78, 0xbb], vnid, access_lport2, False, True)
|
macauley_cheng | 681958a | 2015-11-11 10:32:05 +0800 | [diff] [blame] | 904 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:bb',
|
macauley_cheng | 0a0a7f6 | 2015-11-06 11:36:50 +0800 | [diff] [blame] | 905 | dl_vlan_enable= True,
|
| 906 | vlan_vid=access_port1_vid)
|
| 907 | pkt = str(parsed_pkt)
|
| 908 | self.dataplane.send(access_phy_port1, pkt)
|
| 909 | #verify packet on access port
|
| 910 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst='00:12:34:56:78:bb',
|
| 911 | dl_vlan_enable= True,
|
| 912 | vlan_vid=access_port2_vid)
|
| 913 | pkt = str(parsed_pkt)
|
| 914 | verify_packet(self, pkt, access_phy_port2)
|
| 915 | verify_no_other_packets(self)
|
| 916 |
|
| 917 | #exit verification so clear all configuration
|
| 918 | delete_all_flows(self.controller)
|
| 919 | delete_all_groups(self.controller)
|
| 920 |
|
| 921 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 922 | lport=access_lport1, phy_port=access_phy_port1,
|
| 923 | vlan=access_port1_vid, vnid=vnid, operation="delete")
|
| 924 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 925 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 926 | lport=access_lport2, phy_port=access_phy_port2,
|
| 927 | vlan=access_port2_vid, vnid=vnid, operation="delete")
|
| 928 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 929 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 930 | lport=access_lport3, phy_port=access_phy_port3,
|
| 931 | vlan=access_port3_vid, vnid=vnid, operation="delete")
|
| 932 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport3, access_phy_port3, access_port3_vid, vnid);
|
| 933 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 934 |
|
| 935 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=None, next_hop_id=None, operation="delete")
|
| 936 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 937 |
|
| 938 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 939 | dst_mac=dst_mac_mcast,
|
| 940 | phy_port=access_phy_port3,
|
| 941 | vlan=access_port3_vid, operation="delete")
|
| 942 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 943 |
|
| 944 |
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 945 | class AccessWithNetwork(base_tests.SimpleDataPlane):
|
| 946 | def runTest(self):
|
macauley | ee5bfa7 | 2015-08-03 10:11:14 +0800 | [diff] [blame] | 947 | """
|
| 948 | first verify flood over unicast,
|
| 949 | second verify flood over mcast
|
| 950 | """
|
| 951 | if config["switch_ip"] == None:
|
| 952 | logging.error("Doesn't configure switch IP")
|
| 953 | return
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 954 | delete_all_flows(self.controller)
|
| 955 | delete_all_groups(self.controller)
|
macauley | ee5bfa7 | 2015-08-03 10:11:14 +0800 | [diff] [blame] | 956 |
|
| 957 | access_port1_vid=1
|
| 958 | access_phy_port1=config["port_map"].keys()[0]
|
| 959 | access_lport1=0x10001
|
| 960 | access_lport1_mac=[0x00, 0x00, 0x00, 0x77, 0x77, 0x77]
|
| 961 | access_lport1_mac_str=(":".join(map(str, map(hex, access_lport1_mac)))).replace("0x", "")
|
| 962 | access_port2_vid=0
|
| 963 | access_phy_port2=config["port_map"].keys()[1]
|
| 964 | access_lport2=0x10002
|
| 965 | access_lport2_mac=[0x00,0x00, 0x00, 0x00, 0x00, 0x02]
|
| 966 | access_lport2_mac_str=(":".join(map(str, map(hex, access_lport2_mac)))).replace("0x", "")
|
| 967 | vnid=10
|
| 968 | next_hop_id=1
|
| 969 | next_hop_id_mcast=2
|
| 970 | dst_mac="00:00:11:22:22:11"
|
| 971 | mcast_ipv4="224.1.1.1"
|
| 972 | dst_mac_mcast="01:00:5e:01:01:01"
|
| 973 | network_port_phy_port=config["port_map"].keys()[2]
|
| 974 | network_lport=0x10003
|
| 975 | network_port_vlan=2
|
| 976 | network_port_sip="192.168.1.1"
|
| 977 | network_port_dip="192.168.2.1"
|
| 978 | network_lport_mac=[0x00,0x00, 0x00, 0x00, 0x00, 0x03]
|
| 979 | network_lport_mac_str=(":".join(map(str, map(hex, network_lport_mac)))).replace("0x", "")
|
| 980 |
|
| 981 |
|
| 982 |
|
| 983 | feature_reply=get_featureReplay(self)
|
| 984 | #get switch CPU mac
|
| 985 | str_datapath_id_f= "{:016x}".format(feature_reply.datapath_id)
|
| 986 | str_datapath_id=':'.join([str_datapath_id_f[i:i+2] for i in range(0, len(str_datapath_id_f), 2)])
|
| 987 | switch_cpu_mac_str=str_datapath_id[6:]
|
| 988 | switch_cpu_mac = switch_cpu_mac_str.split(":")
|
| 989 | switch_cpu_mac=[int(switch_cpu_mac[i],16) for i in range(0, len(switch_cpu_mac))]
|
| 990 |
|
| 991 | #add config vtep/vtap/nexthop/vni
|
| 992 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 993 | dst_mac=dst_mac,
|
| 994 | phy_port=network_port_phy_port,
|
| 995 | vlan=network_port_vlan)
|
| 996 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
| 997 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 998 |
|
| 999 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 1000 | dst_mac=dst_mac_mcast,
|
| 1001 | phy_port=network_port_phy_port,
|
| 1002 | vlan=network_port_vlan)
|
| 1003 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id, dst_mac, network_port_phy_port, network_port_vlan);
|
| 1004 |
|
| 1005 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 1006 |
|
| 1007 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=mcast_ipv4, next_hop_id=next_hop_id_mcast)
|
| 1008 | #vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=None, next_hop_id=None)
|
| 1009 | logging.info("config VNI %lx", vnid);
|
| 1010 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 1011 |
|
| 1012 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1013 | lport=access_lport1, phy_port=access_phy_port1,
|
| 1014 | vlan=access_port1_vid, vnid=vnid)
|
| 1015 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport1, access_phy_port1, access_port1_vid, vnid);
|
| 1016 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 1017 |
|
| 1018 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1019 | lport=access_lport2, phy_port=access_phy_port2,
|
| 1020 | vlan=access_port2_vid, vnid=vnid)
|
| 1021 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport2, access_phy_port2, access_port2_vid, vnid);
|
| 1022 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 1023 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1024 | lport=network_lport,
|
| 1025 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 1026 | next_hop_id=next_hop_id,
|
| 1027 | vnid=vnid)
|
| 1028 | logging.info("config VTEP 0x%lx, SRC_IP %s, DST_IP %s, NEXTHOP_ID %d", network_lport, network_port_sip, network_port_dip, next_hop_id);
|
| 1029 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 1030 |
|
| 1031 | #add port table to have vxlan ability
|
| 1032 | add_port_table_flow(self.controller)
|
| 1033 | add_port_table_flow(self.controller, is_overlay=False)
|
| 1034 |
|
| 1035 | #for network port need l2 interface group to decide vlan tag or not
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 1036 | add_one_l2_interface_group(self.controller, network_port_phy_port, vlan_id=network_port_vlan)
|
macauley | ee5bfa7 | 2015-08-03 10:11:14 +0800 | [diff] [blame] | 1037 | #add network mac
|
| 1038 | add_overlay_bridge_flow(self.controller, network_lport_mac, vnid, network_lport, False, True)
|
| 1039 | add_overlay_bridge_flow(self.controller, access_lport1_mac, vnid, access_lport1, False, True)
|
| 1040 |
|
| 1041 | #add termination table for network port
|
| 1042 | add_termination_flow(self.controller, in_port=network_port_phy_port, eth_type=0x0800,
|
| 1043 | dst_mac=switch_cpu_mac, vlanid=network_port_vlan)
|
| 1044 | #add vlan table for network port rx packet class vlan
|
| 1045 | add_one_vlan_table_flow(self.controller, of_port=network_port_phy_port,
|
| 1046 | vlan_id=network_port_vlan)
|
| 1047 |
|
| 1048 | #tx packet on access lport 1
|
| 1049 | parsed_pkt = simple_udp_packet(pktlen=96, eth_dst=network_lport_mac_str,
|
| 1050 | dl_vlan_enable= True,
|
| 1051 | vlan_vid=access_port1_vid)
|
| 1052 | pkt = str(parsed_pkt)
|
| 1053 | self.dataplane.send(access_phy_port1, pkt)
|
| 1054 | #verify packet on network port
|
| 1055 | #need find a way to verify vxlan header
|
| 1056 | parsed_pkt = simple_udp_packet(pktlen=92, eth_dst=network_lport_mac_str)
|
| 1057 | pkt = str(parsed_pkt)
|
| 1058 | verify_packet(self, pkt, network_port_phy_port)
|
| 1059 | verify_no_other_packets(self)
|
| 1060 |
|
| 1061 | #tx packet on network lport
|
| 1062 | inner_pkt = simple_udp_packet(pktlen=96, eth_dst=access_lport1_mac_str)
|
| 1063 | vxlan_pkt = simple_vxlan_packet(eth_dst=switch_cpu_mac_str,
|
| 1064 | vnid=vnid,
|
| 1065 | ip_dst= network_port_sip,
|
| 1066 | ip_src=network_port_dip,
|
| 1067 | inner_payload=inner_pkt)
|
| 1068 | self.dataplane.send(network_port_phy_port, str(vxlan_pkt))
|
| 1069 | #verify
|
| 1070 | inner_pkt = simple_udp_packet(pktlen=100, eth_dst=access_lport1_mac_str,
|
| 1071 | dl_vlan_enable= True,
|
| 1072 | vlan_vid=access_port1_vid)
|
| 1073 |
|
| 1074 | verify_packet(self, inner_pkt, access_phy_port1)
|
| 1075 | verify_no_other_packets(self)
|
| 1076 |
|
| 1077 |
|
| 1078 | #exit verification so clear all configuration
|
| 1079 | delete_all_flows(self.controller)
|
| 1080 | delete_all_groups(self.controller)
|
| 1081 |
|
| 1082 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1083 | lport=access_lport1, phy_port=access_phy_port1,
|
| 1084 | vlan=access_port1_vid, vnid=vnid, operation="delete")
|
| 1085 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 1086 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1087 | lport=access_lport2, phy_port=access_phy_port2,
|
| 1088 | vlan=access_port2_vid, vnid=vnid, operation="delete")
|
| 1089 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 1090 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1091 | lport=network_lport,
|
| 1092 | src_ip=network_port_sip, dst_ip=network_port_dip,
|
| 1093 | next_hop_id=next_hop_id,
|
| 1094 | vnid=vnid, operation="delete")
|
| 1095 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 1096 |
|
| 1097 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=None, next_hop_id=None, operation="delete")
|
| 1098 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 1099 |
|
| 1100 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id,
|
| 1101 | dst_mac=dst_mac,
|
| 1102 | phy_port=network_port_phy_port,
|
| 1103 | vlan=network_port_vlan, operation="delete")
|
| 1104 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 1105 |
|
| 1106 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 1107 | dst_mac=dst_mac_mcast,
|
| 1108 | phy_port=network_port_phy_port,
|
| 1109 | vlan=network_port_vlan, operation="delete")
|
| 1110 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 1111 |
|
| 1112 | class NetworkToNetwork(base_tests.SimpleDataPlane):
|
| 1113 | def runTest(self):
|
macauley | ee5bfa7 | 2015-08-03 10:11:14 +0800 | [diff] [blame] | 1114 | """
|
| 1115 | This case can't work, can't identify it is chip limitation or not
|
| 1116 | """
|
| 1117 | return
|
| 1118 | if config["switch_ip"] == None:
|
| 1119 | logging.error("Doesn't configure switch IP")
|
| 1120 | return
|
| 1121 |
|
macauley | 68ace67 | 2015-07-27 17:40:50 +0800 | [diff] [blame] | 1122 | delete_all_flows(self.controller)
|
macauley | ee5bfa7 | 2015-08-03 10:11:14 +0800 | [diff] [blame] | 1123 | delete_all_groups(self.controller)
|
| 1124 |
|
| 1125 | vnid=10
|
| 1126 | mcast_ipv4="224.1.1.1"
|
| 1127 | dst_mac_mcast="01:00:5e:01:01:01"
|
| 1128 | next_hop_id_mcast=3
|
| 1129 |
|
| 1130 | access_port1_vid=1
|
| 1131 | access_phy_port1=config["port_map"].keys()[0]
|
| 1132 | access_lport1=0x10001
|
| 1133 |
|
| 1134 | network_port1_phy_port=config["port_map"].keys()[1]
|
| 1135 | network_lport1=0x10003
|
| 1136 | network_port1_vlan=2
|
| 1137 | network_port1_sip="192.168.1.1"
|
| 1138 | network_port1_dip="192.168.2.1"
|
| 1139 | network_port1_next_hop_id=1
|
| 1140 | network_port1_dst_mac="00:00:11:22:22:11"
|
| 1141 | network_lport1_mac=[0x00,0x00, 0x00, 0x00, 0x00, 0x33]
|
| 1142 | network_lport1_mac_str=(":".join(map(str, map(hex, network_lport1_mac)))).replace("0x", "")
|
| 1143 |
|
| 1144 | network_port2_phy_port=config["port_map"].keys()[2]
|
| 1145 | network_lport2=0x10004
|
| 1146 | network_port2_vlan=3
|
| 1147 | network_port2_sip="192.168.3.1"
|
| 1148 | network_port2_dip="192.168.4.1"
|
| 1149 | network_port2_next_hop_id=2
|
| 1150 | network_port2_dst_mac="00:00:11:22:22:22"
|
| 1151 | network_lport2_mac=[0x00,0x00, 0x00, 0x00, 0x00, 0x44]
|
| 1152 | network_lport2_mac_str=(":".join(map(str, map(hex, network_lport2_mac)))).replace("0x", "")
|
| 1153 |
|
| 1154 | feature_reply=get_featureReplay(self)
|
| 1155 | #get switch CPU mac
|
| 1156 | str_datapath_id_f= "{:016x}".format(feature_reply.datapath_id)
|
| 1157 | str_datapath_id=':'.join([str_datapath_id_f[i:i+2] for i in range(0, len(str_datapath_id_f), 2)])
|
| 1158 | switch_cpu_mac_str=str_datapath_id[6:]
|
| 1159 | switch_cpu_mac = switch_cpu_mac_str.split(":")
|
| 1160 | switch_cpu_mac=[int(switch_cpu_mac[i],16) for i in range(0, len(switch_cpu_mac))]
|
| 1161 | #config vlxan
|
| 1162 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=network_port1_next_hop_id,
|
| 1163 | dst_mac=network_port1_dst_mac,
|
| 1164 | phy_port=network_port1_phy_port,
|
| 1165 | vlan=network_port1_vlan)
|
| 1166 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", network_port1_next_hop_id, network_port1_dst_mac, network_port1_phy_port, network_port1_vlan);
|
| 1167 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 1168 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=network_port2_next_hop_id,
|
| 1169 | dst_mac=network_port2_dst_mac,
|
| 1170 | phy_port=network_port2_phy_port,
|
| 1171 | vlan=network_port2_vlan)
|
| 1172 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", network_port2_next_hop_id, network_port2_dst_mac, network_port2_phy_port, network_port2_vlan);
|
| 1173 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 1174 |
|
| 1175 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 1176 | dst_mac=dst_mac_mcast,
|
| 1177 | phy_port=network_port1_phy_port,
|
| 1178 | vlan=network_port1_vlan)
|
| 1179 | logging.info("config NextHop %d, DST_MAC %s, PHY %d, VLAN %d", next_hop_id_mcast, dst_mac_mcast, network_port1_phy_port, network_port1_vlan);
|
| 1180 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml)==True)
|
| 1181 |
|
| 1182 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=mcast_ipv4, next_hop_id=next_hop_id_mcast)
|
| 1183 | logging.info("config VNI %lx", vnid);
|
| 1184 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 1185 |
|
| 1186 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1187 | lport=access_lport1, phy_port=access_phy_port1,
|
| 1188 | vlan=access_port1_vid, vnid=vnid)
|
| 1189 | logging.info("config VTAP 0x%lx, PHY %d, VID %d, VNID %lx", access_lport1, access_phy_port1, access_port1_vid, vnid);
|
| 1190 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 1191 |
|
| 1192 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1193 | lport=network_lport1,
|
| 1194 | src_ip=network_port1_sip, dst_ip=network_port1_dip,
|
| 1195 | next_hop_id=network_port1_next_hop_id,
|
| 1196 | vnid=vnid)
|
| 1197 | logging.info("config VTEP 0x%lx, SRC_IP %s, DST_IP %s, NEXTHOP_ID %d", network_lport1, network_port1_sip, network_port1_dip, network_port1_next_hop_id);
|
| 1198 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 1199 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1200 | lport=network_lport2,
|
| 1201 | src_ip=network_port2_sip, dst_ip=network_port2_dip,
|
| 1202 | next_hop_id=network_port2_next_hop_id,
|
| 1203 | vnid=vnid)
|
| 1204 | logging.info("config VTEP 0x%lx, SRC_IP %s, DST_IP %s, NEXTHOP_ID %d", network_lport2, network_port2_sip, network_port2_dip, network_port2_next_hop_id);
|
| 1205 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 1206 |
|
| 1207 | #add port table to have vxlan ability
|
| 1208 | add_port_table_flow(self.controller)
|
| 1209 |
|
| 1210 | #for network port need l2 interface group to decide vlan tag or not
|
castroflavio | dd17147 | 2015-12-08 13:55:58 -0500 | [diff] [blame] | 1211 | add_one_l2_interface_group(self.controller, network_port1_phy_port, vlan_id=network_port1_vlan)
|
| 1212 | add_one_l2_interface_group(self.controller, network_port2_phy_port, vlan_id=network_port2_vlan)
|
macauley | ee5bfa7 | 2015-08-03 10:11:14 +0800 | [diff] [blame] | 1213 | #add network mac
|
| 1214 | add_overlay_bridge_flow(self.controller, network_lport1_mac, vnid, network_lport1, False, True)
|
| 1215 | add_overlay_bridge_flow(self.controller, network_lport2_mac, vnid, network_lport2, False, True)
|
| 1216 |
|
| 1217 | #add termination table for network port
|
| 1218 | add_termination_flow(self.controller, in_port=network_port1_phy_port, eth_type=0x0800,
|
| 1219 | dst_mac=switch_cpu_mac, vlanid=network_port1_vlan)
|
| 1220 | add_termination_flow(self.controller, in_port=network_port2_phy_port, eth_type=0x0800,
|
| 1221 | dst_mac=switch_cpu_mac, vlanid=network_port2_vlan)
|
| 1222 | #add vlan table for network port rx packet class vlan
|
| 1223 | add_one_vlan_table_flow(self.controller, of_port=network_port1_phy_port,
|
| 1224 | vlan_id=network_port1_vlan)
|
| 1225 | add_one_vlan_table_flow(self.controller, of_port=network_port2_phy_port,
|
| 1226 | vlan_id=network_port2_vlan)
|
| 1227 |
|
| 1228 | #packet tx on network port 1 rx on network port 2
|
| 1229 | inner_pkt = simple_udp_packet(pktlen=96, eth_dst=network_lport2_mac_str)
|
| 1230 | vxlan_pkt = simple_vxlan_packet(eth_dst=switch_cpu_mac_str,
|
| 1231 | vnid=vnid,
|
| 1232 | ip_dst= network_port1_sip,
|
| 1233 | ip_src=network_port1_dip,
|
| 1234 | inner_payload=inner_pkt)
|
| 1235 | self.dataplane.send(network_port1_phy_port, str(vxlan_pkt))
|
| 1236 | #verify
|
| 1237 | verify_packet(self, str(inner_pkt), network_port2_phy_port)
|
| 1238 | verify_no_other_packets(self)
|
| 1239 |
|
| 1240 |
|
| 1241 |
|
| 1242 | #exit verification so clear all configuration
|
| 1243 | delete_all_flows(self.controller)
|
| 1244 | delete_all_groups(self.controller)
|
| 1245 |
|
| 1246 | vtap_conf_xml=get_vtap_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1247 | lport=access_lport1, phy_port=access_phy_port1,
|
| 1248 | vlan=access_port1_vid, vnid=vnid, operation="delete")
|
| 1249 | assert(send_edit_config(config["switch_ip"], vtap_conf_xml) == True)
|
| 1250 |
|
| 1251 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1252 | lport=network_lport1,
|
| 1253 | src_ip=network_port1_sip, dst_ip=network_port1_dip,
|
| 1254 | next_hop_id=network_port1_next_hop_id,
|
| 1255 | vnid=vnid, operation="delete")
|
| 1256 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 1257 | vtep_conf_xml=get_vtep_lport_config_xml(dp_id=feature_reply.datapath_id,
|
| 1258 | lport=network_lport2,
|
| 1259 | src_ip=network_port2_sip, dst_ip=network_port2_dip,
|
| 1260 | next_hop_id=network_port2_next_hop_id,
|
| 1261 | vnid=vnid, operation="delete")
|
| 1262 | assert(send_edit_config(config["switch_ip"], vtep_conf_xml) == True)
|
| 1263 | vni_config_xml=get_vni_config_xml(vni_id=vnid, mcast_ipv4=None, next_hop_id=None, operation="delete")
|
| 1264 | assert(send_edit_config(config["switch_ip"], vni_config_xml) == True)
|
| 1265 |
|
| 1266 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=network_port1_next_hop_id,
|
| 1267 | dst_mac=network_port1_dst_mac,
|
| 1268 | phy_port=network_port1_phy_port,
|
| 1269 | vlan=network_port1_vlan, operation="delete")
|
| 1270 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 1271 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=network_port2_next_hop_id,
|
| 1272 | dst_mac=network_port2_dst_mac,
|
| 1273 | phy_port=network_port2_phy_port,
|
| 1274 | vlan=network_port2_vlan, operation="delete")
|
| 1275 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 1276 | next_hop_conf_xml=get_next_hop_config_xml(next_hop_id=next_hop_id_mcast,
|
| 1277 | dst_mac=dst_mac_mcast,
|
| 1278 | phy_port=network_port1_phy_port,
|
| 1279 | vlan=network_port1_vlan, operation="delete")
|
| 1280 | assert(send_edit_config(config["switch_ip"], next_hop_conf_xml) == True)
|
| 1281 | |