Skip to content

Commit

Permalink
zebra: apply the suggestion by reviewer
Browse files Browse the repository at this point in the history
Signed-off-by: Yamato Sugawara <yamato.sugawara@linecorp.com>
  • Loading branch information
Drumato committed Nov 9, 2021
1 parent 341f19e commit f4c954b
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 12 deletions.
3 changes: 2 additions & 1 deletion bgpd/bgp_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -9243,7 +9243,8 @@ DEFPY (no_bgp_srv6_locator,
return CMD_SUCCESS;
}

DEFPY(show_bgp_srv6, show_bgp_srv6_cmd, "show bgp segment-routing srv6 [json]",
DEFPY(show_bgp_srv6, show_bgp_srv6_cmd,
"show bgp segment-routing srv6 [json]",
SHOW_STR BGP_STR
"BGP Segment Routing\n"
"BGP Segment Routing SRv6\n" JSON_STR)
Expand Down
3 changes: 1 addition & 2 deletions lib/srv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,10 @@ bool srv6_locator_chunks_exhausted(const struct srv6_locator *loc)
struct listnode *node;
struct srv6_locator_chunk *chunk;

for (ALL_LIST_ELEMENTS_RO(loc->chunks, node, chunk)) {
for (ALL_LIST_ELEMENTS_RO(loc->chunks, node, chunk))
if (chunk->proto == 0 && chunk->instance == 0
&& chunk->session_id == 0 && chunk->keep == 0)
return false;
}

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/srv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct srv6_locator {
uint64_t current;
bool status_up;
struct list *chunks;
uint8_t perchunk_bits_length;
uint8_t chunk_bits_length;

QOBJ_FIELDS;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def teardown_module(mod):
tgen = get_topogen()
tgen.stop_topology()


def get_locator_chunk_from_bgpd(router, locator):
router.vtysh_cmd(
"""
Expand All @@ -83,11 +84,13 @@ def get_locator_chunk_from_bgpd(router, locator):
""".format(locator)
)


def get_locator_chunk_from_sharpd(router, locator):
router.vtysh_cmd(
"sharp srv6-manager get-locator-chunk {}".format(locator)
)


def release_locator_chunk_from_bgpd(router, locator):
router.vtysh_cmd(
"""
Expand All @@ -98,11 +101,13 @@ def release_locator_chunk_from_bgpd(router, locator):
""".format(locator)
)


def release_locator_chunk_from_sharpd(router, locator):
router.vtysh_cmd(
"sharp srv6-manager release-locator-chunk {}".format(locator)
)


def test_srv6():
tgen = get_topogen()
if tgen.routers_have_failure():
Expand Down Expand Up @@ -182,6 +187,7 @@ def check_bgpd_chunk(router, expected_file):
check_sharpd_chunk(router, "step6/expected_sharpd_chunks.json")
check_bgpd_chunk(router, "step6/expected_bgpd_chunks.json")


if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))
2 changes: 1 addition & 1 deletion zebra/zebra_srv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ separate_locator_prefix_into_chunk(struct srv6_locator *loc,
uint16_t chunk_index)
{
struct prefix_ipv6 chunk_prefix = loc->prefix;
chunk_prefix.prefixlen += loc->perchunk_bits_length;
chunk_prefix.prefixlen += loc->chunk_bits_length;
chunk_prefix.prefix.s6_addr32[2] = (uint32_t)htons(chunk_index);
return chunk_prefix;
}
Expand Down
2 changes: 1 addition & 1 deletion zebra/zebra_srv6_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ DEFPY (locator_prefix,

// currently srv6 manager supports the chunk_length to only 4 bits.
// the feature enables us to manipulate at most 16 chunks.
locator->perchunk_bits_length = DEFAULT_SRV6_LOCATOR_PERCHUNK_LEN;
locator->chunk_bits_length = DEFAULT_SRV6_LOCATOR_PERCHUNK_LEN;

if (!list_isempty(locator->chunks)) {
for (ALL_LIST_ELEMENTS_RO(locator->chunks, node, chunk)) {
Expand Down

0 comments on commit f4c954b

Please sign in to comment.