mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 18:41:56 +00:00
Merge pull request #12155 from LabNConsulting/working/lb/opaque-lsa-zero-len
OSPF: allow for zero length opaque LSAs
This commit is contained in:
commit
7c7db42f46
@ -1099,6 +1099,12 @@ async def async_main(args):
|
|||||||
for action in args.actions:
|
for action in args.actions:
|
||||||
_s = action.split(",")
|
_s = action.split(",")
|
||||||
what = _s.pop(False)
|
what = _s.pop(False)
|
||||||
|
if what.casefold() == "wait":
|
||||||
|
stime = int(_s.pop(False))
|
||||||
|
logging.info("waiting %s seconds", stime)
|
||||||
|
await asyncio.sleep(stime)
|
||||||
|
logging.info("wait complete: %s seconds", stime)
|
||||||
|
continue
|
||||||
ltype = int(_s.pop(False))
|
ltype = int(_s.pop(False))
|
||||||
if ltype == 11:
|
if ltype == 11:
|
||||||
addr = ip(0)
|
addr = ip(0)
|
||||||
|
@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
#define OPAQUE_TYPE_RANGE_RESERVED(type) (127 < (type) && (type) <= 255)
|
#define OPAQUE_TYPE_RANGE_RESERVED(type) (127 < (type) && (type) <= 255)
|
||||||
|
|
||||||
#define OSPF_OPAQUE_LSA_MIN_SIZE 4U
|
#define OSPF_OPAQUE_LSA_MIN_SIZE 0 /* RFC5250 imposes no minimum */
|
||||||
|
|
||||||
#define VALID_OPAQUE_INFO_LEN(lsahdr) \
|
#define VALID_OPAQUE_INFO_LEN(lsahdr) \
|
||||||
((ntohs((lsahdr)->length) >= sizeof(struct lsa_header)) \
|
((ntohs((lsahdr)->length) >= sizeof(struct lsa_header)) \
|
||||||
|
@ -468,28 +468,249 @@ def _test_opaque_add_del(tgen, apibin):
|
|||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
)
|
)
|
||||||
p = r1.popen([apibin, "-v", "add,11,232,3,ebadf00d"])
|
p = r1.popen(
|
||||||
|
[
|
||||||
|
apibin,
|
||||||
|
"-v",
|
||||||
|
"add,9,10.0.1.1,230,2,00000202",
|
||||||
|
"add,10,1.2.3.4,231,1,00010101",
|
||||||
|
"wait,1",
|
||||||
|
"add,10,1.2.3.4,231,2",
|
||||||
|
"add,11,232,3,ebadf00d",
|
||||||
|
"wait,20",
|
||||||
|
"del,10,1.2.3.4,231,1",
|
||||||
|
"del,10,1.2.3.4,231,2",
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
add_input_dict = {
|
||||||
|
"areas": {
|
||||||
|
"1.2.3.4": {
|
||||||
|
"linkLocalOpaqueLsa": [
|
||||||
|
{
|
||||||
|
"lsId": "230.0.0.2",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "8142",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"areaLocalOpaqueLsa": [
|
||||||
|
{
|
||||||
|
"lsId": "231.0.0.1",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "695a",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lsId": "231.0.0.2",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "4881",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"asExternalOpaqueLsa": [
|
||||||
|
{
|
||||||
|
"lsId": "232.0.0.3",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "c666",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
step("reachable: check for add LSAs")
|
||||||
|
json_cmd = "show ip ospf da json"
|
||||||
|
assert verify_ospf_database(tgen, r1, add_input_dict, json_cmd) is None
|
||||||
|
assert verify_ospf_database(tgen, r2, add_input_dict, json_cmd) is None
|
||||||
|
|
||||||
|
numcs = 3
|
||||||
|
json_cmds = [
|
||||||
|
"show ip ospf da opaque-link json",
|
||||||
|
"show ip ospf da opaque-area json",
|
||||||
|
"show ip ospf da opaque-as json",
|
||||||
|
]
|
||||||
|
add_detail_input_dict = [
|
||||||
|
{
|
||||||
|
"linkLocalOpaqueLsa": {
|
||||||
|
"areas": {
|
||||||
|
"1.2.3.4": [
|
||||||
|
{
|
||||||
|
"linkStateId": "230.0.0.2",
|
||||||
|
"advertisingRouter": "192.168.0.1",
|
||||||
|
"lsaSeqNumber": "80000001",
|
||||||
|
"checksum": "8142",
|
||||||
|
"length": 24,
|
||||||
|
"opaqueId": 2,
|
||||||
|
"opaqueDataLength": 4,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"areaLocalOpaqueLsa": {
|
||||||
|
"areas": {
|
||||||
|
"1.2.3.4": [
|
||||||
|
{
|
||||||
|
"linkStateId": "231.0.0.1",
|
||||||
|
"advertisingRouter": "192.168.0.1",
|
||||||
|
"lsaSeqNumber": "80000001",
|
||||||
|
"checksum": "695a",
|
||||||
|
"length": 24,
|
||||||
|
"opaqueDataLength": 4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"linkStateId": "231.0.0.2",
|
||||||
|
"advertisingRouter": "192.168.0.1",
|
||||||
|
"lsaSeqNumber": "80000001",
|
||||||
|
"checksum": "4881",
|
||||||
|
"length": 20,
|
||||||
|
"opaqueDataLength": 0,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"asExternalOpaqueLsa": [
|
||||||
|
{
|
||||||
|
"linkStateId": "232.0.0.3",
|
||||||
|
"advertisingRouter": "192.168.0.1",
|
||||||
|
"lsaSeqNumber": "80000001",
|
||||||
|
"checksum": "c666",
|
||||||
|
"length": 24,
|
||||||
|
"opaqueDataLength": 4,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
]
|
||||||
|
i = 0
|
||||||
|
while i < numcs:
|
||||||
|
step("reachable: check for add LSA details: %s" % json_cmds[i])
|
||||||
|
assert (
|
||||||
|
verify_ospf_database(tgen, r1, add_detail_input_dict[i], json_cmds[i])
|
||||||
|
is None
|
||||||
|
)
|
||||||
|
assert (
|
||||||
|
verify_ospf_database(tgen, r2, add_detail_input_dict[i], json_cmds[i])
|
||||||
|
is None
|
||||||
|
)
|
||||||
|
i += 1
|
||||||
|
|
||||||
# Wait for add notification
|
# Wait for add notification
|
||||||
# RECV: LSA update msg for LSA 232.0.0.3 in area 0.0.0.0 seq 0x80000001 len 24 age 9
|
# RECV: LSA update msg for LSA 232.0.0.3 in area 0.0.0.0 seq 0x80000001 len 24 age 9
|
||||||
|
|
||||||
ls_id = "232.0.0.3"
|
step("reachable: check for API add notifications")
|
||||||
waitfor = "RECV:.*update msg.*LSA {}.*age ([0-9]+)".format(ls_id)
|
ls_ids = ["230.0.0.2", "231.0.0.1", "231.0.0.2", "232.0.0.3"]
|
||||||
_ = _wait_output(pread, waitfor)
|
for ls_id in ls_ids:
|
||||||
|
waitfor = "RECV:.*update msg.*LSA {}.*age ([0-9]+)".format(ls_id)
|
||||||
|
_ = _wait_output(pread, waitfor)
|
||||||
|
|
||||||
|
del_input_dict = {
|
||||||
|
"areas": {
|
||||||
|
"1.2.3.4": {
|
||||||
|
"linkLocalOpaqueLsa": [
|
||||||
|
{
|
||||||
|
"lsId": "230.0.0.2",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "8142",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"areaLocalOpaqueLsa": [
|
||||||
|
{
|
||||||
|
"lsaAge": 3600,
|
||||||
|
"lsId": "231.0.0.1",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "695a",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lsaAge": 3600,
|
||||||
|
"lsId": "231.0.0.2",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "4881",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"asExternalOpaqueLsa": [
|
||||||
|
{
|
||||||
|
"lsId": "232.0.0.3",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "c666",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
step("reachable: check for explicit withdrawal LSAs")
|
||||||
|
json_cmd = "show ip ospf da json"
|
||||||
|
assert verify_ospf_database(tgen, r1, del_input_dict, json_cmd) is None
|
||||||
|
assert verify_ospf_database(tgen, r2, del_input_dict, json_cmd) is None
|
||||||
|
|
||||||
p.terminate()
|
p.terminate()
|
||||||
if p.wait():
|
if p.wait():
|
||||||
comm_error(p)
|
comm_error(p)
|
||||||
|
del_input_dict = {
|
||||||
|
"areas": {
|
||||||
|
"1.2.3.4": {
|
||||||
|
"linkLocalOpaqueLsa": [
|
||||||
|
{
|
||||||
|
"lsaAge": 3600,
|
||||||
|
"lsId": "230.0.0.2",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "8142",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"areaLocalOpaqueLsa": [
|
||||||
|
{
|
||||||
|
"lsaAge": 3600,
|
||||||
|
"lsId": "231.0.0.1",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "695a",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"lsaAge": 3600,
|
||||||
|
"lsId": "231.0.0.2",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "4881",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"asExternalOpaqueLsa": [
|
||||||
|
{
|
||||||
|
"lsaAge": 3600,
|
||||||
|
"lsId": "232.0.0.3",
|
||||||
|
"advertisedRouter": "192.168.0.1",
|
||||||
|
"sequenceNumber": "80000001",
|
||||||
|
"checksum": "c666",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
step("reachable: check for implicit withdrawal LSAs")
|
||||||
|
json_cmd = "show ip ospf da json"
|
||||||
|
assert verify_ospf_database(tgen, r1, del_input_dict, json_cmd) is None
|
||||||
|
assert verify_ospf_database(tgen, r2, del_input_dict, json_cmd) is None
|
||||||
|
|
||||||
# step("reachable: check for flush/age out")
|
# step("reachable: check for flush/age out")
|
||||||
# # Wait for max age notification
|
# # Wait for max age notification
|
||||||
# waitfor = "RECV:.*update msg.*LSA {}.*age 3600".format(ls_id)
|
# waitfor = "RECV:.*update msg.*LSA {}.*age 3600".format(ls_id)
|
||||||
# _wait_output(pread, waitfor)
|
# _wait_output(pread, waitfor)
|
||||||
|
|
||||||
step("reachable: check for delete")
|
step("reachable: check for API delete notifications")
|
||||||
# Wait for delete notification
|
ls_ids = ["231.0.0.1", "231.0.0.2", "230.0.0.2", "232.0.0.3"]
|
||||||
waitfor = "RECV:.*delete msg.*LSA {}.*".format(ls_id)
|
for ls_id in ls_ids:
|
||||||
_wait_output(pread, waitfor)
|
waitfor = "RECV:.*delete msg.*LSA {}.*".format(ls_id)
|
||||||
|
_ = _wait_output(pread, waitfor)
|
||||||
except Exception:
|
except Exception:
|
||||||
if p:
|
if p:
|
||||||
p.terminate()
|
p.terminate()
|
||||||
|
Loading…
Reference in New Issue
Block a user