sonic-net / sonic-mgmt

Configuration management examples for SONiC
Other
201 stars 727 forks source link

[decap] What's the decap configuration is need #272

Open okanchou9 opened 7 years ago

okanchou9 commented 7 years ago

Hi,

According to the wiki page of IPv4 Decapsulation test: https://github.com/Azure/SONiC/wiki/IPv4-Decapsulation-test

There is a comment to talk about the test assumes all routes and decapsulation are set prior by to test. Would like to know what's the decap setup before running the test since no luck while tried couple configurations of decap rules.

Please let me know if any, thanks.


Regards, Kenie Liu

stcheng commented 7 years ago

@sihuihan88

sihuihan88 commented 7 years ago

Hi Kenie,

The decap configuration is enabled by default. The test should be able to run without any setting. FYI


admin@sonic:~$ docker exec -it swss bash
root@sonic:/# cd etc/swss/config.d/
root@sonic:/etc/swss/config.d#
root@sonic:/etc/swss/config.d#
root@sonic:/etc/swss/config.d# ls
00-copp.config.json  ipinip.json  mirror.json  
root@sonic:/etc/swss/config.d# cat ipinip.json
[
    {
        "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL" : {
            "tunnel_type":"IPINIP",
            "src_ip":"25.64.96.17",
            "dst_ip":"25.64.96.17",
            "dscp_mode":"pipe",
            "ecn_mode":"copy_from_outer",
            "ttl_mode":"pipe"
        },
        "OP": "SET"
    }
]

root@sonic:/etc/swss/config.d#
admin@sonic:~$ redis-cli
127.0.0.1:6379> select 0
OK
127.0.0.1:6379> keys *TUNNEL*
1) "TUNNEL_DECAP_TABLE:IPINIP_TUNNEL"
127.0.0.1:6379> select 1
OK
127.0.0.1:6379[1]> keys *TUNNEL*
1) "ASIC_STATE:SAI_OBJECT_TYPE_TUNNEL:oid:0x290000000005ac"
2) "ASIC_STATE:SAI_OBJECT_TYPE_TUNNEL_TERM_TABLE_ENTRY:oid:0x2a0000000005ad"
127.0.0.1:6379[1]>
'''
okanchou9 commented 7 years ago

@sihuihan88,

Thank you for the information of decap configuration. Decap is running perfectly after I'm trying to send couple IP-in-IP packet from PTF to DUT and DUT will decap those packets and forward them to correct inner dst IP address.

But I found something strange in the decap script:

  1. For ansible/roles/test/templates/fib.j2, why join default route 0.0.0.0/0 as inner DST IP address into decap test? Since the goal of this test is verifying DUT will decap IP-in-IP packet and forward them to inner DSR IP address when DUT received IP-in-IP packets. But if the inner DST IP address is 0.0.0.0/0, this packet will be forwarded to the gateway IP address of eth0 interface as known as the mgmt interface of DUT and decap test will failed because PTF will not capture this packet after all.

Sample code in fib.py:

{# defualt route#}
{% if testbed_type == 't1' %}
0.0.0.0/0 {% for ifname, v in minigraph_neighbors.iteritems() %}{% if "T2" in v.name %}{{ '[%d]' % minigraph_port_indices[ifname]}}{% if not loop.last %} {% endif %}{% endif %}{% endfor %}
{% elif testbed_type == 't0' or testbed_type == 't0-64' or testbed_type == 't1-lag' %}
0.0.0.0/0 {% for portchannel, v in minigraph_portchannels.iteritems() %}
[{% for member in v.members %}{{ '%d' % minigraph_port_indices[member]}}{% if not loop.last %} {% endif %}{% endfor %}]{% if not loop.last %} {% endif %}{% endfor %}
{% endif %}
  1. For fib.py, why EXCLUDE_IPV4_PREFIXES will be joined into decap test? Those IPv4 prefixes are not exist in DUT's routing table and join them into test will failed the test.

Sample code in fib.py:

for ip in EXCLUDE_IPV4_PREFIXES:
self._ipv4_lpm_dict[ip] = self.NextHop()
  1. For lpm.py, the functionality of ranges function is not correct when it calculate the interval between each route. The following is the sample:

I'm still trying to modify the script to debug those issues, will commit the fix and raise a merge request to master branch. Please let me know if any, thanks.


Regards, Kenie Liu