go.ligato.io/vpp-agent/v3@v3.5.0/tests/robot/suites/crudIPv6/linux_ip_route_crudIPv6.robot (about) 1 *** Settings *** 2 Library OperatingSystem 3 #Library RequestsLibrary 4 #Library SSHLibrary timeout=60s 5 #Library String 6 7 Resource ../../variables/${VARIABLES}_variables.robot 8 9 Resource ../../libraries/all_libs.robot 10 11 Force Tags crud IPv6 12 Suite Setup Testsuite Setup 13 Suite Teardown Testsuite Teardown 14 Test Setup TestSetup 15 Test Teardown TestTeardown 16 17 *** Variables *** 18 ${VARIABLES}= common 19 ${ENV}= common 20 ${WAIT_TIMEOUT}= 20s 21 ${SYNC_SLEEP}= 3s 22 ${RESYNC_SLEEP}= 15s 23 # wait for resync vpps after restart 24 ${RESYNC_WAIT}= 30s 25 ${VETH_IP1}= fd33::1:b:0:0:1 26 ${VETH_IP2}= fd33::1:b:0:0:2 27 ${VETH_IP3}= fd31::1:a:0:0:1 28 ${VETH_IP4}= fd31::1:a:0:0:2 29 ${VETH_IP5}= fd33::1:b:0:0:5 30 ${VETH_IP6}= fd33::1:b:0:0:6 31 ${VETH_IP7}= fd33::1:b:0:0:7 32 ${GOOGLE_IP}= 2001:4860:4860::8888 33 ${QUAD9_IP}= 2620:fe::fe 34 *** Test Cases *** 35 Configure Environment 36 [Tags] setup 37 Add Agent VPP Node agent_vpp_1 38 39 Show Interfaces Before Setup 40 vpp_term: Show Interfaces agent_vpp_1 41 42 Setup Interfaces 43 etcdctl.Put Veth Interface Via Linux Plugin node=agent_vpp_1 namespace=ns1 name=ns1_veth1 host_if_name=ns1_veth1_linux mac=d2:74:8c:12:67:d2 peer=ns2_veth2 ip=${VETH_IP1} prefix=64 44 etcdctl.Put Veth Interface Via Linux Plugin node=agent_vpp_1 namespace=ns2 name=ns2_veth2 host_if_name=ns2_veth2_linux mac=92:c7:42:67:ab:cd peer=ns1_veth1 ip=${VETH_IP2} prefix=64 45 46 Chceck Interfaces 47 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Interfaces node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 48 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Interfaces node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 49 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Interfaces Link node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 50 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Interfaces Link node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 51 52 Ping 53 # This should work by default after veth interface setup 54 Ping6 in namespace node=agent_vpp_1 namespace=ns1 ip=${VETH_IP2} 55 Ping6 in namespace node=agent_vpp_1 namespace=ns2 ip=${VETH_IP1} 56 57 Create Linux Routes 58 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=${VETH_IP5} prefix=128 next_hop=${VETH_IP2} 59 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 ip=${VETH_IP6} prefix=128 next_hop=${VETH_IP1} 60 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=${GOOGLE_IP} prefix=128 next_hop=${VETH_IP2} 61 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128 next_hop=${VETH_IP1} 62 63 Check Linux Routes 64 #sleep 36 65 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns1 ip=${VETH_IP5} 66 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns2 ip=${VETH_IP6} 67 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns1 ip=${GOOGLE_IP} 68 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns2 ip=${QUAD9_IP} 69 70 71 # created routes should not exist in other namespace 72 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns2 ip=${VETH_IP5} 73 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns1 ip=${VETH_IP6} 74 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns2 ip=${GOOGLE_IP} 75 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns1 ip=${QUAD9_IP} 76 77 Read Route Information From Setup Database 78 etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns1_veth1 ip=${VETH_IP5} prefix=128 79 etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns2_veth2 ip=${VETH_IP6} prefix=128 80 etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns1_veth1 ip=${GOOGLE_IP} prefix=128 81 etcdctl.Get Linux Route As Json node=agent_vpp_1 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128 82 83 Change Linux Routes Without Deleting Key (Changing Metric) 84 # changing of gateway - this is incorrect/ the record would not be put in the database - Let us change metric 85 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=${GOOGLE_IP} prefix=128 next_hop=${VETH_IP2} metric=55 86 87 88 # testing if there is the new metric 89 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes Metric node=agent_vpp_1 namespace=ns1 ip=${GOOGLE_IP} metric=55 90 91 Change Linux Routes At First Deleting Key And Putting The Same Secondly Deleting Key Then Putting It To Other Namespace 92 etcdctl.Delete Linux Route node=agent_vpp_1 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128 93 94 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns2 ip=${QUAD9_IP} 95 96 # we create exactly the same as deleted route 97 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128 next_hop=${VETH_IP1} 98 99 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns2 ip=${QUAD9_IP} 100 101 # delete again 102 etcdctl.Delete Linux Route node=agent_vpp_1 interface=ns2_veth2 ip=${QUAD9_IP} prefix=128 103 104 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns2 ip=${QUAD9_IP} 105 106 # we try to transfer route to other namespace - there is also need to change appropriately gateway 107 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns1 interface=ns1_veth1 ip=${QUAD9_IP} prefix=128 next_hop=${VETH_IP2} 108 109 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Removed Linux Route IPv6 node=agent_vpp_1 namespace=ns2 ip=${QUAD9_IP} 110 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} 111 112 At first create route and after that create inteface in namespace 3 113 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 ip=${VETH_IP5} prefix=128 next_hop=${VETH_IP4} 114 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 ip=${VETH_IP2} prefix=128 next_hop=${VETH_IP4} 115 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 ip=${VETH_IP1} prefix=128 next_hop=${VETH_IP4} 116 etcdctl.Put Linux Route node=agent_vpp_1 namespace=ns2 interface=ns2_veth3 ip=${VETH_IP7} prefix=128 next_hop=${VETH_IP3} 117 118 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} 119 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} 120 121 122 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Interfaces node=agent_vpp_1 namespace=ns3 interface=ns3_veth3 123 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Interfaces node=agent_vpp_1 namespace=ns2 interface=ns2_veth3 124 125 Ping6 in namespace node=agent_vpp_1 namespace=ns2 ip=${VETH_IP3} 126 Ping6 in namespace node=agent_vpp_1 namespace=ns3 ip=${VETH_IP4} 127 128 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns3 ip=${VETH_IP1} 129 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns3 ip=${VETH_IP2} 130 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns3 ip=${VETH_IP5} 131 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns2 ip=${VETH_IP7} 132 133 # tested also above, but repeat after giving exact routes 134 Ping6 in namespace node=agent_vpp_1 namespace=ns3 ip=${VETH_IP4} 135 Ping6 in namespace node=agent_vpp_1 namespace=ns2 ip=${VETH_IP3} 136 # this works 137 Ping6 in namespace node=agent_vpp_1 namespace=ns3 ip=${VETH_IP2} 138 139 # this does not work 140 # https://serverfault.com/questions/568839/linux-network-namespaces-ping-fails-on-specific-veth 141 # https://unix.stackexchange.com/questions/391193/how-to-forward-traffic-between-linux-network-namespaces 142 #Ping6 in namespace node=agent_vpp_1 namespace=ns3 ip=192.168.22.1 143 144 # routy sa zalozia po uspesnom pingu zo ns3 ?! or ping fails 145 # Ping6 in namespace node=agent_vpp_1 namespace=ns1 ip=192.169.22.3 146 147 Check linux Routes On VPP1 148 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns1 ip=${VETH_IP5} 149 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns2 ip=${VETH_IP6} 150 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes Gateway node=agent_vpp_1 namespace=ns1 ip=${GOOGLE_IP} next_hop=${VETH_IP2} 151 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} 152 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns3 ip=${VETH_IP1} 153 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns3 ip=${VETH_IP2} 154 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns3 ip=${VETH_IP5} 155 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns2 ip=${VETH_IP7} 156 157 Remove VPP Nodes 158 Remove All Nodes 159 Sleep ${RESYNC_SLEEP} 160 161 Start VPP1 Again 162 Add Agent VPP Node agent_vpp_1 163 Sleep ${RESYNC_WAIT} 164 165 Check Linux Interfaces On VPP1 After Resync 166 ${out}= Execute In Container agent_vpp_1 ip netns exec ns1 ip a 167 Should Contain ${out} ns1_veth1_linux 168 169 ${out}= Execute In Container agent_vpp_1 ip netns exec ns2 ip a 170 Should Contain ${out} ns2_veth2_linux 171 Should Contain ${out} ns2_veth3_linux 172 173 ${out}= Execute In Container agent_vpp_1 ip netns exec ns3 ip a 174 Should Contain ${out} ns3_veth3_linux 175 176 Check linux Routes On VPP1 After Resync 177 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns1 ip=${VETH_IP5} 178 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns2 ip=${VETH_IP6} 179 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes Gateway node=agent_vpp_1 namespace=ns1 ip=${GOOGLE_IP} next_hop=${VETH_IP2} 180 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} 181 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns3 ip=${VETH_IP1} 182 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns3 ip=${VETH_IP2} 183 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns3 ip=${VETH_IP5} 184 Wait Until Keyword Succeeds ${WAIT_TIMEOUT} ${SYNC_SLEEP} Check Linux Routes IPv6 node=agent_vpp_1 namespace=ns2 ip=${VETH_IP7} 185 186 187 *** Keywords *** 188 Check Linux Interfaces 189 [Arguments] ${node} ${namespace} ${interface} 190 ${out}= Execute In Container ${node} ip netns exec ${namespace} ip -6 a 191 Should Contain ${out} ${interface} 192 193 Check Linux Interfaces Link 194 [Arguments] ${node} ${namespace} ${interface} 195 ${out}= Execute In Container ${node} ip netns exec ${namespace} ip -6 link 196 Log ${out} 197 198 Check Linux Routes 199 [Arguments] ${node} ${namespace} ${ip} 200 ${out}= Execute In Container ${node} ip netns exec ${namespace} ip route show 201 Should Contain ${out} ${ip} via 202 203 Check Linux Routes IPv6 204 [Arguments] ${node} ${namespace} ${ip} 205 ${out}= Execute In Container ${node} ip netns exec ${namespace} ip -6 route show 206 Should Contain ${out} ${ip} via 207 208 Check Linux Routes Gateway 209 [Arguments] ${node} ${namespace} ${ip} ${next_hop}=${EMPTY} 210 ${out}= Execute In Container ${node} ip netns exec ${namespace} ip -6 route show 211 Should Contain ${out} ${ip} via ${next_hop} 212 213 Check Linux Routes Metric 214 [Arguments] ${node} ${namespace} ${ip} ${metric} 215 ${out}= Execute In Container ${node} ip netns exec ${namespace} ip -6 route show 216 Should Match Regexp ${out} ${ip} via.*metric ${metric}\\s 217 218 Check Removed Linux Route 219 [Arguments] ${node} ${namespace} ${ip} 220 ${out}= Execute In Container ${node} ip netns exec ${namespace} ip -6 route show 221 Should Not Contain ${out} ${ip} via 222 223 Check Removed Linux Route IPv6 224 [Arguments] ${node} ${namespace} ${ip} 225 ${out}= Execute In Container ${node} ip netns exec ${namespace} ip -6 route show 226 Should Not Contain ${out} ${ip} via 227 228 Ping in namespace 229 [Arguments] ${node} ${namespace} ${ip} 230 ${out}= Execute In Container ${node} ip netns exec ${namespace} ping -c 5 ${ip} 231 Should Contain ${out} from ${ip} 232 Should Not Contain ${out} 100% packet loss 233 234 Ping6 in namespace 235 [Arguments] ${node} ${namespace} ${ip} 236 ${out}= Execute In Container ${node} ip netns exec ${namespace} ping6 -c 5 ${ip} 237 Should Contain ${out} from ${ip} 238 Should Not Contain ${out} 100% packet loss 239 240 241 *** Keywords *** 242 TestSetup 243 Make Datastore Snapshots ${TEST_NAME}_test_setup 244 245 TestTeardown 246 Make Datastore Snapshots ${TEST_NAME}_test_teardown 247