Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Traffic test cleanup: bridge, linux route #1545

Merged
merged 3 commits into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions tests/robot/libraries/etcdctl.robot
Original file line number Diff line number Diff line change
Expand Up @@ -294,23 +294,18 @@ Put Veth Interface Via Linux Plugin
Put Json ${uri} ${data}

Put Linux Route
[Arguments] ${node} ${namespace} ${interface} ${routename} ${ip} ${next_hop} ${prefix}=24 ${metric}=100 ${isdefault}=false
[Arguments] ${node} ${namespace} ${interface} ${ip} ${next_hop} ${prefix}=24 ${metric}=100
${data}= OperatingSystem.Get File ${CURDIR}/../resources/linux_static_route.json
${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/route/${ip}/${prefix}/${interface}
${data}= Replace Variables ${data}
Put Json ${uri} ${data}

Put Default Linux Route
[Arguments] ${node} ${namespace} ${interface} ${routename} ${next_hop} ${metric}=100 ${isdefault}=true
[Arguments] ${node} ${namespace} ${interface} ${next_hop} ${metric}=100 ${ipv6}=${FALSE}
${data}= OperatingSystem.Get File ${CURDIR}/../resources/linux_default_static_route.json
${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/route/${routename}
${data}= Replace Variables ${data}
Put Json ${uri} ${data}

Put Linux Route Without Interface
[Arguments] ${node} ${namespace} ${routename} ${ip} ${next_hop} ${prefix}=24 ${metric}=100
${data}= OperatingSystem.Get File ${CURDIR}/../resources/linux_static_route_without_interface.json
${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/route/${routename}
${destination}= Set Variable If ${ipv6} ::/0 0.0.0.0/0
${destination_network}= Set Variable If ${ipv6} 0:0:0:0:0:0:0:0/0 0.0.0.0/0
${uri}= Set Variable /vnf-agent/${node}/config/linux/l3/${AGENT_VER}/route/${destination}/${interface}
${data}= Replace Variables ${data}
Put Json ${uri} ${data}

Expand Down
39 changes: 39 additions & 0 deletions tests/robot/libraries/vpp_term.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,42 @@ def parse_stn_rule(info):
pass

return state['ip_address'], state['iface'], state['next_node']


def parse_memif_info(info):
state = []
sockets_line = []
for line in info.splitlines():
if line:
try:
_ = int(line.strip().split()[0])
sockets_line.append(line)
except ValueError:
pass
if line.strip().split()[0] == "flags":
if "admin-up" in line:
state.append("enabled=1")
if "slave" in line:
state.append("role=slave")
if "connected" in line:
state.append("connected=1")
if line.strip().split()[0] == "socket-id":
try:
socket_id = int(line.strip().split()[1])
state.append("id="+line.strip().split()[3])
for sock_line in sockets_line:
try:
num = int(sock_line.strip().split()[0])
if num == socket_id:
state.append("socket=" + sock_line.strip().split()[-1])
except ValueError:
pass
except ValueError:
pass
if "enabled=1" not in state:
state.append("enabled=0")
if "role=slave" not in state:
state.append("role=master")
if "connected=1" not in state:
state.append("connected=0")
return state
10 changes: 3 additions & 7 deletions tests/robot/resources/linux_default_static_route.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"name": "${routename}",
"default": ${isdefault},
"namespace": {
"name": "${namespace}",
"type": 1
},
"interface": "${interface}",
"outgoing_interface": "${interface}",
"scope": "GLOBAL",
"dst_network": "${destination_network}",
"gw_addr": "${next_hop}",
"metric": ${metric}
}
34 changes: 17 additions & 17 deletions tests/robot/suites/crud/linux_ip_route_crud.robot
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ Setup Interfaces
Ping in namespace node=agent_vpp_1 namespace=ns2 ip=192.168.22.1

Create Linux Routes
Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 routename=pingingveth2 ip=192.168.22.2 prefix=32 next_hop=192.168.22.1
Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 routename=pingingveth1 ip=192.168.22.1 prefix=32 next_hop=192.168.22.2
Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 routename=pinginggoogl ip=8.8.8.8 prefix=32 next_hop=192.168.22.1
Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 routename=pinging9 ip=9.9.9.9 prefix=32 next_hop=192.168.22.2
Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=192.168.22.2 prefix=32 next_hop=192.168.22.1
Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 ip=192.168.22.1 prefix=32 next_hop=192.168.22.2
Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=8.8.8.8 prefix=32 next_hop=192.168.22.1
Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 ip=9.9.9.9 prefix=32 next_hop=192.168.22.2

Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes node=agent_vpp_1 namespace=ns1 ip=192.168.22.2
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes node=agent_vpp_1 namespace=ns2 ip=192.168.22.1
Expand All @@ -60,46 +60,46 @@ Create Linux Routes
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route node=agent_vpp_1 namespace=ns1 ip=9.9.9.9

Read Route Information From Setup Database
Get Linux Route As Json node=agent_vpp_1 interface=ns1_veth1 ip=192.168.22.2 prefix=32 #routename=pingingveth2
Get Linux Route As Json node=agent_vpp_1 interface=ns2_veth2 ip=192.168.22.1 prefix=32 #routename=pingingveth1
Get Linux Route As Json node=agent_vpp_1 interface=ns1_veth1 ip=8.8.8.8 prefix=32 #routename=pinginggoogl
Get Linux Route As Json node=agent_vpp_1 interface=ns2_veth2 ip=9.9.9.9 prefix=32 #routename=pinging9
Get Linux Route As Json node=agent_vpp_1 interface=ns1_veth1 ip=192.168.22.2 prefix=32
Get Linux Route As Json node=agent_vpp_1 interface=ns2_veth2 ip=192.168.22.1 prefix=32
Get Linux Route As Json node=agent_vpp_1 interface=ns1_veth1 ip=8.8.8.8 prefix=32
Get Linux Route As Json node=agent_vpp_1 interface=ns2_veth2 ip=9.9.9.9 prefix=32

Change Linux Routes Without Deleting Key (Changing Metric)
# changing of gateway - this is incorrect/ the record would not be put in the database - Let us change metric
Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 routename=pinginggoogl ip=8.8.8.8 prefix=32 next_hop=192.168.22.1 metric=55
Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=8.8.8.8 prefix=32 next_hop=192.168.22.1 metric=55

# testing if there is the new metric
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes Metric node=agent_vpp_1 namespace=ns1 ip=8.8.8.8 metric=55

Change Linux Routes At First Deleting Key And Putting The Same Secondly Deleting Key Then Putting It To Other Namespace
Delete Linux Route node=agent_vpp_1 interface=ns2_veth2 ip=9.9.9.9 prefix=32 #routename=pinging9
Delete Linux Route node=agent_vpp_1 interface=ns2_veth2 ip=9.9.9.9 prefix=32


Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route node=agent_vpp_1 namespace=ns2 ip=9.9.9.9

# we create exactly the same as deleted route
Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 routename=pinging9 ip=9.9.9.9 prefix=32 next_hop=192.168.22.2
Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 ip=9.9.9.9 prefix=32 next_hop=192.168.22.2

Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes node=agent_vpp_1 namespace=ns2 ip=9.9.9.9

# delete again
Delete Linux Route node=agent_vpp_1 interface=ns2_veth2 ip=9.9.9.9 prefix=32 #routename=pinging9
Delete Linux Route node=agent_vpp_1 interface=ns2_veth2 ip=9.9.9.9 prefix=32

Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route node=agent_vpp_1 namespace=ns2 ip=9.9.9.9

# we try to transfer route to other namespace - there is also need to change appropriately gateway
Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 routename=pinging9 ip=9.9.9.9 prefix=32 next_hop=192.168.22.1
Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=9.9.9.9 prefix=32 next_hop=192.168.22.1


Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route node=agent_vpp_1 namespace=ns2 ip=9.9.9.9
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes Gateway node=agent_vpp_1 namespace=ns1 ip=9.9.9.9 next_hop=192.168.22.1

At first create route and after that create inteface in namespace 3
Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 routename=pingingns2_veth3 ip=192.169.22.22 prefix=32 next_hop=192.169.22.3
Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 routename=pingingns2_veth2 ip=192.168.22.2 prefix=32 next_hop=192.169.22.3
Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 routename=pingingns1_veth1 ip=192.168.22.1 prefix=32 next_hop=192.169.22.3
Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth3 routename=pingingns3_veth3 ip=192.169.22.3 prefix=32 next_hop=192.169.22.22
Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 ip=192.169.22.22 prefix=32 next_hop=192.169.22.3
Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 ip=192.168.22.2 prefix=32 next_hop=192.169.22.3
Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 ip=192.168.22.1 prefix=32 next_hop=192.169.22.3
Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth3 ip=192.169.22.3 prefix=32 next_hop=192.169.22.22

Put Veth Interface Via Linux Plugin node=agent_vpp_1 namespace=ns3 name=ns3_veth3 host_if_name=ns3_veth3_linux mac=92:c7:42:67:ab:ce peer=ns2_veth3 ip=192.169.22.3
Put Veth Interface Via Linux Plugin node=agent_vpp_1 namespace=ns2 name=ns2_veth3 host_if_name=ns2_veth3_linux mac=92:c7:42:67:ab:cf peer=ns3_veth3 ip=192.169.22.22
Expand Down
34 changes: 17 additions & 17 deletions tests/robot/suites/crudIPv6/linux_ip_route_crudIPv6.robot
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ Ping
Ping6 in namespace node=agent_vpp_1 namespace=ns2 ip=${VETH_IP1}

Create Linux Routes
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 routename=pingingveth2 ip=${VETH_IP5} prefix=128 next_hop=${VETH_IP2}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 routename=pingingveth1 ip=${VETH_IP6} prefix=128 next_hop=${VETH_IP1}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 routename=pinginggoogl ip=${GOOGLE_IP} prefix=128 next_hop=${VETH_IP2}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 routename=pinging9 ip=${QUAD9_IP} prefix=128 next_hop=${VETH_IP1}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=${VETH_IP5} prefix=128 next_hop=${VETH_IP2}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 ip=${VETH_IP6} prefix=128 next_hop=${VETH_IP1}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=${GOOGLE_IP} prefix=128 next_hop=${VETH_IP2}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128 next_hop=${VETH_IP1}

Check Linux Routes
#sleep 36
Expand All @@ -75,45 +75,45 @@ Check Linux Routes
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns1 ip=${QUAD9_IP}

Read Route Information From Setup Database
etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns1_veth1 ip=${VETH_IP5} prefix=128 #routename=pingingveth2
etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns2_veth2 ip=${VETH_IP6} prefix=128 #routename=pingingveth1
etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns1_veth1 ip=${GOOGLE_IP} prefix=128 #routename=pinginggoogl
etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128 #routename=pinging9
etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns1_veth1 ip=${VETH_IP5} prefix=128
etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns2_veth2 ip=${VETH_IP6} prefix=128
etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns1_veth1 ip=${GOOGLE_IP} prefix=128
etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128

Change Linux Routes Without Deleting Key (Changing Metric)
# changing of gateway - this is incorrect/ the record would not be put in the database - Let us change metric
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 routename=pinginggoogl ip=${GOOGLE_IP} prefix=128 next_hop=${VETH_IP2} metric=55
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=${GOOGLE_IP} prefix=128 next_hop=${VETH_IP2} metric=55


# testing if there is the new metric
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes Metric node=agent_vpp_1 namespace=ns1 ip=${GOOGLE_IP} metric=55

Change Linux Routes At First Deleting Key And Putting The Same Secondly Deleting Key Then Putting It To Other Namespace
etcdctl.Delete Linux Route node=agent_vpp_1 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128 #routename=pinging9
etcdctl.Delete Linux Route node=agent_vpp_1 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128

Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns2 ip=${QUAD9_IP}

# we create exactly the same as deleted route
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 routename=pinging9 ip=${QUAD9_IP} prefix=128 next_hop=${VETH_IP1}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128 next_hop=${VETH_IP1}

Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns2 ip=${QUAD9_IP}

# delete again
etcdctl.Delete Linux Route node=agent_vpp_1 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128 #routename=pinging9
etcdctl.Delete Linux Route node=agent_vpp_1 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128

Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns2 ip=${QUAD9_IP}

# we try to transfer route to other namespace - there is also need to change appropriately gateway
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 routename=pinging9 ip=${QUAD9_IP} prefix=128 next_hop=${VETH_IP2}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=${QUAD9_IP} prefix=128 next_hop=${VETH_IP2}

Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns2 ip=${QUAD9_IP}
Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes Gateway node=agent_vpp_1 namespace=ns1 ip=${QUAD9_IP} next_hop=${VETH_IP2}

At first create route and after that create inteface in namespace 3
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 routename=pingingns2_veth3 ip=${VETH_IP5} prefix=128 next_hop=${VETH_IP4}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 routename=pingingns2_veth2 ip=${VETH_IP2} prefix=128 next_hop=${VETH_IP4}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 routename=pingingns1_veth1 ip=${VETH_IP1} prefix=128 next_hop=${VETH_IP4}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth3 routename=pingingns3_veth3 ip=${VETH_IP7} prefix=128 next_hop=${VETH_IP3}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 ip=${VETH_IP5} prefix=128 next_hop=${VETH_IP4}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 ip=${VETH_IP2} prefix=128 next_hop=${VETH_IP4}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 ip=${VETH_IP1} prefix=128 next_hop=${VETH_IP4}
etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth3 ip=${VETH_IP7} prefix=128 next_hop=${VETH_IP3}

etcdctl.Put Veth Interface Via Linux Plugin node=agent_vpp_1 namespace=ns3 name=ns3_veth3 host_if_name=ns3_veth3_linux mac=92:c7:42:67:ab:ce peer=ns2_veth3 ip=${VETH_IP3}
etcdctl.Put Veth Interface Via Linux Plugin node=agent_vpp_1 namespace=ns2 name=ns2_veth3 host_if_name=ns2_veth3_linux mac=92:c7:42:67:ab:cf peer=ns3_veth3 ip=${VETH_IP4}
Expand Down
Loading