Skip to content

Commit a3391a9

Browse files
authored
Fix the OID for ipCidrRouteDest (#10)
1 parent 5c30a36 commit a3391a9

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/sonic_ax_impl/mibs/ietf/rfc4292.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def ip2tuple(ip):
1414
class RouteUpdater(MIBUpdater):
1515
def __init__(self):
1616
super().__init__()
17+
self.tos = 0 # ipCidrRouteTos
1718
self.db_conn, _, _, _, _, _ = mibs.init_sync_d_interface_tables()
18-
# call our update method once to "seed" data before the "Agent" starts accepting requests.
1919
self.update_data()
2020

2121
def update_data(self):
@@ -37,7 +37,7 @@ def update_data(self):
3737
ent = self.db_conn.get_all(mibs.APPL_DB, routestr, blocking=True)
3838
nexthops = ent[b"nexthop"].decode()
3939
for nh in nexthops.split(','):
40-
sub_id = ip2tuple(ipn.network_address) + ip2tuple(ipn.netmask) + ip2tuple(nh)
40+
sub_id = ip2tuple(ipn.network_address) + ip2tuple(ipn.netmask) + (self.tos,) + ip2tuple(nh)
4141
self.route_dest_list.append(sub_id)
4242
self.route_dest_map[sub_id] = ipn.network_address.packed
4343

tests/test_forward.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_network_order(self):
3030
self.assertEqual(ips, "0.1.2.3")
3131

3232
def test_getpdu(self):
33-
oid = ObjectIdentifier(23, 0, 1, 0, (1, 3, 6, 1, 2, 1, 4, 24, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 15))
33+
oid = ObjectIdentifier(24, 0, 1, 0, (1, 3, 6, 1, 2, 1, 4, 24, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 15))
3434
get_pdu = GetPDU(
3535
header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0),
3636
oids=[oid]
@@ -49,7 +49,7 @@ def test_getnextpdu(self):
4949
get_pdu = GetNextPDU(
5050
header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0),
5151
oids=(
52-
ObjectIdentifier(20, 0, 0, 0, (1, 3, 6, 1, 2, 1, 4, 24, 4, 1, 1)),
52+
ObjectIdentifier(21, 0, 0, 0, (1, 3, 6, 1, 2, 1, 4, 24, 4, 1, 1, 0)),
5353
)
5454
)
5555

@@ -63,7 +63,7 @@ def test_getnextpdu(self):
6363
self.assertEqual(str(value0.data), ipaddress.ip_address("0.0.0.0").packed.decode())
6464

6565
def test_getnextpdu_exactmatch(self):
66-
oid = ObjectIdentifier(23, 0, 1, 0, (1, 3, 6, 1, 2, 1, 4, 24, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 17))
66+
oid = ObjectIdentifier(24, 0, 1, 0, (1, 3, 6, 1, 2, 1, 4, 24, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 17))
6767
get_pdu = GetNextPDU(
6868
header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0),
6969
oids=[oid]
@@ -84,7 +84,7 @@ def test_getpdu_noinstance(self):
8484
get_pdu = GetPDU(
8585
header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0),
8686
oids=(
87-
ObjectIdentifier(19, 0, 0, 0, (1, 3, 6, 1, 2, 1, 4, 24, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1)),
87+
ObjectIdentifier(20, 0, 0, 0, (1, 3, 6, 1, 2, 1, 4, 24, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1)),
8888
)
8989
)
9090

@@ -100,7 +100,7 @@ def test_getnextpdu_empty(self):
100100
get_pdu = GetNextPDU(
101101
header=PDUHeader(1, PduTypes.GET, 16, 0, 42, 0, 0, 0),
102102
oids=(
103-
ObjectIdentifier(11, 0, 0, 0, (1, 3, 6, 1, 2, 1, 4, 24, 4, 1, 2)),
103+
ObjectIdentifier(12, 0, 0, 0, (1, 3, 6, 1, 2, 1, 4, 24, 4, 1, 1, 1)),
104104
)
105105
)
106106

0 commit comments

Comments
 (0)