Skip to content
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

ospfd: add instance id for one command #16075

Merged
merged 2 commits into from
May 28, 2024

Conversation

anlancs
Copy link
Contributor

@anlancs anlancs commented May 23, 2024

Add the specific instance id for one ospf command, more in commit log.

Copy link
Member

@odd22 odd22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@donaldsharp donaldsharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like ot understand the behavior of othe rinstance based commands. From a quick code look no other command has the combined option here.

ospfd/ospf_vty.c Outdated
@@ -10755,10 +10755,11 @@ DEFUN (ospf_route_aggregation_timer,

DEFPY (show_ip_ospf_gr_helper,
show_ip_ospf_gr_helper_cmd,
"show ip ospf [vrf <NAME|all>] graceful-restart helper [detail] [json]",
"show ip ospf [(1-65535)]$instance [vrf <NAME|all>] graceful-restart helper [detail] [json]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure that instance cannot be mixed with vrf. They are orthogonal. So shouldn't that imply then that it could be instance or vrf?

Copy link
Contributor Author

@anlancs anlancs May 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@donaldsharp @odd22
Yes, the ospf instance can't support vrf, i have pushed new one.
But, i have double-checked the current ospf code, i found it is disorder about instance-id in many ospf commands relating to instance/vrf.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But , this command can be executed successfully:
show ip ospf 1 vrf default database detail json

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is working only because you specify the default vrf for which you could have many instances. But, if you try to specify a different instance than the default one and specify a given vrf, it will not work.

The CLI should be show ip ospf vrf foo ... or show ip ospf 10 ... but not a combination of two.
Thus, the correct CLI syntax should be show ip ospf [{(1-65535)$instance|vrf <NAME|all>}] graceful-restart helper [detail] [json] Note the '{}' to be sure that both options are exclusive.

Just have a look to the creation of OSPF router at the beginning of ospf_vty.c as an example.

I also note, for the various show command, that there is a version with vrf and another DEFUN for the instance version. I agree that there is no graceful-restart show command with instance option while there is one for vrf. Perhaps, the good way to proceed, like for other show CLI commands, is to create a dedicated version of show graceful-restart command for instance option.

@anlancs anlancs requested a review from odd22 May 24, 2024 15:33
Copy link
Member

@odd22 odd22 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLI should be show ip ospf vrf foo ... or show ip ospf 10 ... but not a combination of two.
Thus, the correct CLI syntax should be show ip ospf [{(1-65535)$instance|vrf <NAME|all>}] graceful-restart helper [detail] [json] Note the '{}' to be sure that both options are exclusive.

Just have a look to the creation of OSPF router at the beginning of ospf_vty.c as an example.

I also note, for the various show command, that there is a version with vrf and another DEFUN for the instance version. I agree that there is no graceful-restart show command with instance option while there is one for vrf. Perhaps, the good way to proceed, like for other show CLI commands, is to create a dedicated version of show graceful-restart command for instance option.

Add the specific instance id for the command:
```
show ip ospf [{(1-65535)$instance|vrf <NAME|all>}] graceful-restart helper [detail] [json]
```

Signed-off-by: anlan_cs <[email protected]>
@anlancs
Copy link
Contributor Author

anlancs commented May 25, 2024

Done, thanks for your help. @odd22

@anlancs
Copy link
Contributor Author

anlancs commented May 27, 2024

CI:rerun

@anlancs anlancs requested a review from odd22 May 28, 2024 04:11
Copy link
Member

@riw777 riw777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks okay, waiting on other comments

@donaldsharp
Copy link
Member

I agree that there are a couple of other commands that allow the combination of the two when they should not. We did not catch those when they went in and should be fixed. They have nothing to do with this commit though

@donaldsharp donaldsharp merged commit cccb0cd into FRRouting:master May 28, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants