Skip to content

Commit

Permalink
[orchagent]: VXLAN: Fix oper_status and tunnel encapsulation TTL (PR s…
Browse files Browse the repository at this point in the history
…onic-net#3383)

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
```

The VTEP is really up.

Original PR for that is sonic-net#2080.

Also fixes sonic-net/sonic-buildimage#10004
or at least the error message which hurts debugging.

The next issue is in reachabiity across VXLANs.  This fixes IP/MAC
learning via ARP.  The original PR for that is sonic-net#3216, however it
appears it has its origins in
sonic-net/sonic-buildimage#10050
which goes into greater detail about the issue itself.  Also there
is talk about it here kamelnetworks/sonic#9 as well as another
similar patch here: kamelnetworks@02ee3e3

Fixes sonic-net#3216
Fixes sonic-net#2080
Fixes sonic-net/sonic-buildimage#10050
Fixes sonic-net/sonic-buildimage#10004
Signed-off-by: Brad House (@bradh352)
  • Loading branch information
bradh352 committed Jan 14, 2025
1 parent 9f4a064 commit 6b41306
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7297,7 +7297,9 @@ bool PortsOrch::addTunnel(string tunnel_alias, sai_object_id_t tunnel_id, bool h
{
tunnel.m_learn_mode = SAI_BRIDGE_PORT_FDB_LEARNING_MODE_DISABLE;
}
tunnel.m_oper_status = SAI_PORT_OPER_STATUS_DOWN;
m_portList[tunnel_alias] = tunnel;
saiOidToAlias[tunnel_id] = tunnel_alias;

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

Expand All @@ -7308,6 +7310,7 @@ bool PortsOrch::removeTunnel(Port tunnel)
{
SWSS_LOG_ENTER();

saiOidToAlias.erase(tunnel.m_tunnel_id);
m_portList.erase(tunnel.m_alias);

return true;
Expand Down Expand Up @@ -8257,9 +8260,10 @@ void PortsOrch::updatePortOperStatus(Port &port, sai_port_oper_status_t status)
return;
}

updateDbPortOperStatus(port, status);

if (port.m_type == Port::PHY)
{
updateDbPortOperStatus(port, status);
updateDbPortFlapCount(port, status);
updateGearboxPortOperStatus(port);

Expand Down
5 changes: 3 additions & 2 deletions orchagent/vxlanorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ typedef enum
#define MAX_VLAN_ID 4095

#define MAX_VNI_ID 16777215
#define DEFAULT_TUNNEL_ENCAP_TTL 255

typedef enum
{
Expand Down Expand Up @@ -196,7 +197,7 @@ class VxlanTunnel

bool deleteMapperHw(uint8_t mapper_list, tunnel_map_use_t map_src);
bool createMapperHw(uint8_t mapper_list, tunnel_map_use_t map_src);
bool createTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, bool with_term = true, sai_uint8_t encap_ttl=0);
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);
bool deleteTunnelHw(uint8_t mapper_list, tunnel_map_use_t map_src, bool with_term = true);
void deletePendingSIPTunnel();
void increment_spurious_imr_add(const std::string remote_vtep);
Expand Down Expand Up @@ -299,7 +300,7 @@ class VxlanTunnelOrch : public Orch2


bool createVxlanTunnelMap(string tunnelName, tunnel_map_type_t mapType, uint32_t vni,
sai_object_id_t encap, sai_object_id_t decap, uint8_t encap_ttl=0);
sai_object_id_t encap, sai_object_id_t decap, uint8_t encap_ttl=DEFAULT_TUNNEL_ENCAP_TTL);

bool removeVxlanTunnelMap(string tunnelName, uint32_t vni);

Expand Down
4 changes: 3 additions & 1 deletion tests/test_vxlan_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ def check_vxlan_tunnel(dvs, src_ip, dst_ip, tunnel_map_ids, tunnel_map_entry_ids
'SAI_TUNNEL_ATTR_DECAP_MAPPERS': decapstr,
'SAI_TUNNEL_ATTR_ENCAP_MAPPERS': encapstr,
'SAI_TUNNEL_ATTR_PEER_MODE': 'SAI_TUNNEL_PEER_MODE_P2MP',
'SAI_TUNNEL_ATTR_ENCAP_SRC_IP': src_ip
'SAI_TUNNEL_ATTR_ENCAP_SRC_IP': src_ip,
'SAI_TUNNEL_ATTR_ENCAP_TTL_MODE': 'SAI_TUNNEL_TTL_MODE_PIPE_MODEL',
'SAI_TUNNEL_ATTR_ENCAP_TTL_VAL': '255'
}
)

Expand Down

0 comments on commit 6b41306

Please sign in to comment.