Skip to content

Commit 94468a8

Browse files
committed
[orchagent]: VXLAN: Fix oper_status and tunnel encapsulation TTL (sonic-net#3383)
* VXLAN: Fix oper_status and tunnel encapsulation TTL This fixes 2 issues across a range of open tickets building upon patches created by others with modifications as requested by @VladimirKuk. The first issue this resolves is the status shown for remote vteps which in the fact that it is wrong makes debugging nearly impossible: ``` +------------+------------+-------------------+--------------+ | SIP | DIP | Creation Source | OperStatus | +============+============+===================+==============+ | 172.16.0.1 | 172.16.0.2 | EVPN | oper_down | +------------+------------+-------------------+--------------+ Total count : 1 ```
1 parent 1aabc6c commit 94468a8

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

orchagent/portsorch.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7285,7 +7285,9 @@ bool PortsOrch::addTunnel(string tunnel_alias, sai_object_id_t tunnel_id, bool h
72857285
{
72867286
tunnel.m_learn_mode = SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE;
72877287
}
7288+
tunnel.m_oper_status = SAI_PORT_OPER_STATUS_DOWN;
72887289
m_portList[tunnel_alias] = tunnel;
7290+
saiOidToAlias[tunnel_id] = tunnel_alias;
72897291

72907292
SWSS_LOG_INFO("addTunnel:: %" PRIx64, tunnel_id);
72917293

@@ -7296,6 +7298,7 @@ bool PortsOrch::removeTunnel(Port tunnel)
72967298
{
72977299
SWSS_LOG_ENTER();
72987300

7301+
saiOidToAlias.erase(tunnel.m_tunnel_id);
72997302
m_portList.erase(tunnel.m_alias);
73007303

73017304
return true;
@@ -8253,9 +8256,10 @@ void PortsOrch::updatePortOperStatus(Port &port, sai_port_oper_status_t status)
82538256
return;
82548257
}
82558258

8259+
updateDbPortOperStatus(port, status);
8260+
82568261
if (port.m_type == Port::PHY)
82578262
{
8258-
updateDbPortOperStatus(port, status);
82598263
updateDbPortFlapCount(port, status);
82608264
updateGearboxPortOperStatus(port);
82618265

orchagent/vxlanorch.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ typedef enum
4646
#define MAX_VLAN_ID 4095
4747

4848
#define MAX_VNI_ID 16777215
49+
#define DEFAULT_TUNNEL_ENCAP_TTL 255
4950

5051
typedef enum
5152
{
@@ -196,7 +197,7 @@ class VxlanTunnel
196197

197198
bool deleteMapperHw(uint8_t mapper_list, tunnel_map_use_t map_src);
198199
bool createMapperHw(uint8_t mapper_list, tunnel_map_use_t map_src);
199-
bool createTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, bool with_term = true, sai_uint8_t encap_ttl=0);
200+
bool createTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, bool with_term = true, sai_uint8_t encap_ttl=DEFAULT_TUNNEL_ENCAP_TTL);
200201
bool deleteTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, bool with_term = true);
201202
void deletePendingSIPTunnel();
202203
void increment_spurious_imr_add(const std::string remote_vtep);
@@ -299,7 +300,7 @@ class VxlanTunnelOrch : public Orch2
299300

300301

301302
bool createVxlanTunnelMap(string tunnelName, tunnel_map_type_t mapType, uint32_t vni,
302-
sai_object_id_t encap, sai_object_id_t decap, uint8_t encap_ttl=0);
303+
sai_object_id_t encap, sai_object_id_t decap, uint8_t encap_ttl=DEFAULT_TUNNEL_ENCAP_TTL);
303304

304305
bool removeVxlanTunnelMap(string tunnelName, uint32_t vni);
305306

tests/evpn_tunnel.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,8 @@ def check_vxlan_sip_tunnel(self, dvs, tunnel_name, src_ip, vidlist, vnidlist,
569569
'SAI_TUNNEL_ATTR_ENCAP_MAPPERS': encapstr,
570570
'SAI_TUNNEL_ATTR_PEER_MODE': 'SAI_TUNNEL_PEER_MODE_P2MP',
571571
'SAI_TUNNEL_ATTR_ENCAP_SRC_IP': src_ip,
572+
'SAI_TUNNEL_ATTR_ENCAP_TTL_MODE': 'SAI_TUNNEL_TTL_MODE_PIPE_MODEL',
573+
'SAI_TUNNEL_ATTR_ENCAP_TTL_VAL': '255',
572574
}
573575
)
574576

@@ -675,6 +677,8 @@ def check_vxlan_dip_tunnel(self, dvs, vtep_name, src_ip, dip):
675677
'SAI_TUNNEL_ATTR_ENCAP_MAPPERS': encapstr,
676678
'SAI_TUNNEL_ATTR_ENCAP_SRC_IP': src_ip,
677679
'SAI_TUNNEL_ATTR_ENCAP_DST_IP': dip,
680+
'SAI_TUNNEL_ATTR_ENCAP_TTL_MODE': 'SAI_TUNNEL_TTL_MODE_PIPE_MODEL',
681+
'SAI_TUNNEL_ATTR_ENCAP_TTL_VAL': '255',
678682
}
679683

680684
ret = self.helper.get_key_with_attr(asic_db, self.ASIC_TUNNEL_TABLE, expected_tun_attributes)

tests/test_vxlan_tunnel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ def check_vxlan_tunnel(dvs, src_ip, dst_ip, tunnel_map_ids, tunnel_map_entry_ids
152152
'SAI_TUNNEL_ATTR_DECAP_MAPPERS': decapstr,
153153
'SAI_TUNNEL_ATTR_ENCAP_MAPPERS': encapstr,
154154
'SAI_TUNNEL_ATTR_PEER_MODE': 'SAI_TUNNEL_PEER_MODE_P2MP',
155-
'SAI_TUNNEL_ATTR_ENCAP_SRC_IP': src_ip
155+
'SAI_TUNNEL_ATTR_ENCAP_SRC_IP': src_ip,
156+
'SAI_TUNNEL_ATTR_ENCAP_TTL_MODE': 'SAI_TUNNEL_TTL_MODE_PIPE_MODEL',
157+
'SAI_TUNNEL_ATTR_ENCAP_TTL_VAL': '255'
156158
}
157159
)
158160

0 commit comments

Comments
 (0)