-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dump PCEP session in json format #15125
Dump PCEP session in json format #15125
Conversation
9d3fac8
to
545ba6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits
pathd/path_pcep_cli.c
Outdated
config_opts->keep_alive_seconds); | ||
json_object_int_add(json, "deadTimerConfig", | ||
config_opts->dead_timer_seconds); | ||
json_object_int_add(json, "PcRequest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camelCased please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
pathd/path_pcep_cli.c
Outdated
struct pcep_pcc_info *pcc_info, | ||
json_object *json) | ||
{ | ||
char buf[1024]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use something, but not static numbers? And initializing to zeros could be buf[xxx] = {}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BUFFER_PCE_SIZE
|
||
/* Config Options values */ | ||
config_opts = &pce_opts->config_opts; | ||
json_object_int_add(json, "keepaliveConfig", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Config or Seconds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Configuration parameter. (redundant with config on show running)
pathd/path_pcep_cli.c
Outdated
config_opts->dead_timer_seconds); | ||
json_object_int_add(json, "PcRequest", | ||
config_opts->pcep_request_time_seconds); | ||
json_object_int_add(json, "sessionTimeoutInterval", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We usually specify the units, like sessionTimeoutIntervalSec
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
pathd/path_pcep_cli.c
Outdated
json_object_int_add(json, "nextPLspId", pcc_info->next_plspid); | ||
|
||
if (session != NULL) { | ||
json_object_int_add(json, "sessionKeepalivePceNegotiated", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: same as previous, with units, sessionKeepalivePceNegotiatedSec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
pathd/path_pcep_cli.c
Outdated
json_object_string_add(json, "pceCapabilities", buf); | ||
XFREE(MTYPE_PCEP, session); | ||
} else { | ||
json_object_string_add(json, "warning", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You set messageStatisticsWarning
below, so here would be also a better name to be not a generic? Or messageStatisticsWarning
should be changed to generic warning
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can have both warnings, so I willmove "warning" to "warningSession"
6d86ac3
to
77709d8
Compare
pathd/path_pcep_cli.c
Outdated
@@ -43,6 +43,8 @@ | |||
#define DEFAULT_TIMER_SESSION_TIMEOUT_INTERVAL 30 | |||
#define DEFAULT_DELEGATION_TIMEOUT_INTERVAL 10 | |||
|
|||
#define BUFFER_PCE_SIZE 1024 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the naming is misleading, PCE, but PCC buffer also 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets call it BUFFER_PCC_PCE_SIZE. this deals with comm between, PCC and PCE.
pathd/path_pcep_cli.c
Outdated
config_opts->keep_alive_seconds); | ||
json_object_int_add(json, "deadTimerConfig", | ||
config_opts->dead_timer_seconds); | ||
json_object_int_add(json, "pcRequest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean pcRequest
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pccPcepRequestTimerConfig.
This is a config parameter that defines the time that PCC Waits to have a reply from PCE, before retrying.
pathd/path_pcep_cli.c
Outdated
pce_opts_cli = pcep_cli_find_pce(pcc_peer); | ||
if (pce_opts_cli == NULL) { | ||
vty_out(vty, "%% PCE [%s] does not exist.\n", pcc_peer); | ||
if (json) { | ||
json_object_string_add(json, "warning", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we print pcc_peer for non-JSON output, why can't it be printed here to? json_object_string_addf()
allows that. And same for other warning messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right. added changes.
CI:rerun Retest for new ASAN Memory Leaks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just waiting on @ton31337 's comments
The created counters in pceplib library are structures with a string attribute which is used for further display. This string information is not formatted for json output. Add a second option in the create_subgroup_counter() creation API to provide the json attribute output. Create a json naming compatible with caml format for each subgroup counter used. Signed-off-by: Philippe Guibert <[email protected]>
Add support to dump sr-te pcep session in json output. > ubuntu2204# show sr-te pcep session > PCE q > PCE IP 192.0.2.40 port 4189 > PCC IP 192.0.2.10 port 4189 > PCC MSD 10 > Session Status UP > Precedence 10, best candidate > Confidence normal > Timer: KeepAlive config 30, pce-negotiated 70 > Timer: DeadTimer config 120, pce-negotiated 120 > Timer: PcRequest 30 > Timer: SessionTimeout Interval 30 > Timer: Delegation Timeout 10 > No TCP MD5 Auth > PCE SR Version draft07 > Next PcReq ID 5 > Next PLSP ID 2 > Connected for 171 seconds, since 2023-10-28 09:36:44 UTC > PCC Capabilities: [PCC Initiated LSPs] [Stateful PCE] [SR TE PST] > PCE Capabilities: [Stateful PCE] [SR TE PST] > PCEP Message Statistics > Sent Rcvd > Message Open: 2 1 > Message KeepAlive: 1 6 > Message PcReq: 4 0 > Message PcRep: 0 0 > Message Notify: 4 0 > Message Error: 0 5 > Message Close: 0 0 > Message Report: 5 0 > Message Update: 0 1 > Message Initiate: 0 0 > Message StartTls: 0 0 > Message Erroneous: 0 0 > Total: 16 13 > PCEP Sessions => Configured 1 ; Connected 1 > ubuntu2204# show sr-te pcep session json > { > "pcepSessions":[ > { > "pceName":"q", > "pceAddress":"192.0.2.40", > "pcePort":4189, > "pccAddress":"192.0.2.10", > "pccPort":4189, > "pccMsd":10, > "sessionStatus":"UP", > "bestMultiPce":true, > "precedence":10, > "confidence":"normal", > "keepaliveConfig":30, > "deadTimerConfig":120, > "pccPcepRequestTimerConfig":30, > "sessionTimeoutIntervalSec":30, > "delegationTimeout":10, > "tcpMd5Authentication":false, > "draft07":true, > "draft16AndRfc8408":false, > "nextPcRequestId":5, > "nextPLspId":2, > "sessionKeepalivePceNegotiatedSec":70, > "sessionDeadTimerPceNegotiatedSec":120, > "sessionConnectionDurationSec":177, > "sessionConnectionStartTimeUTC":"2023-10-28 09:36:44", > "pccCapabilities":" [PCC Initiated LSPs] [Stateful PCE] [SR TE PST]", > "pceCapabilities":" [Stateful PCE] [SR TE PST]", > "messageStatisticsReceived":{ > "messageOpen":1, > "messageKeepalive":6, > "messagePcReq":0, > "messagePcRep":0, > "messageNotify":0, > "messageError":5, > "messageClose":0, > "messageReport":0, > "messageUpdate":1, > "messageInitiate":0, > "messageStartTls":0, > "messageErroneous":0, > "total":13 > }, > "messageStatisticsSent":{ > "messageOpen":2, > "messageKeepalive":1, > "messagePcReq":4, > "messagePcRep":0, > "messageNotify":4, > "messageError":0, > "messageClose":0, > "messageReport":5, > "messageUpdate":0, > "messageInitiate":0, > "messageStartTls":0, > "messageErrneous":0, > "total":16 > } > } > ], > "pcepSessionsConfigured":1, > "pcepSessionsConnected":1 > } Signed-off-by: Philippe Guibert <[email protected]>
77709d8
to
dba04c2
Compare
Add support to dump sr-te pcep session in json output.