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

Bgpafisafi #107

Merged
merged 18 commits into from
Jan 27, 2017
Merged

Bgpafisafi #107

merged 18 commits into from
Jan 27, 2017

Conversation

donaldsharp
Copy link
Member

No description provided.

Allow the specification of a VRF_ALL to be
used for CLI.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
The show_adj_route_vpn function is only currently used
in conjunction with the KEEP_OLD_VPN_COMMANDS #define.
Add this function to that define for the moment.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
The bgp_parse_safi function is never called remove it.
Especially as that later commits will properly handle
what this function was trying to do.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
The parser was incorrect for the 'set ... vpn nexthop ...' commands.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Create bgp_vty_find_and_parse_afi_safi_vrf that
will parse the
`show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]]'
part of a command and to return the correct spot we are in the command.

Cleanup 'dampening parameters' part of this command.

Consolidate the creation of the bgp data structure to be a bit cleaner.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Cleanup the bgp bestpath or multipath show commands.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Fix this command to use the correct format for
a show command.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
1) Make [<view|vrf> WORD] consistent
2) Fix inconsistent help string
3) Fix the show .. vrf all command

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@NetDEF-CI
Copy link
Collaborator

Continous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-113/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@NetDEF-CI
Copy link
Collaborator

Continous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-115/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Copy link
Member

@louberger louberger left a comment

Choose a reason for hiding this comment

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

Why:
+#define VRF_ALL UINT16_MAX - 1

}

if (*vrf == VRF_UNKNOWN)
{
Copy link
Member

Choose a reason for hiding this comment

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

how do you initialise vrf in the case vrf_name is already null ( commands with no vrf at all)?
I would lie the *vrf value to be set inside that function.

Copy link
Member Author

Choose a reason for hiding this comment

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

I do not believe this is the right thing to do. Only the calling function knows what the right defaults are for the afi/safi/vrf due to we assume different defaults based upon the command. This approach would break the ability for the calling function to do the right thing. As I stated I will update the Pull Request with better documentation for this funciton.

}
}
else
bgp = NULL;

Copy link
Member

Choose a reason for hiding this comment

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

what happens in the case the command i use is a command without vrf either view parameter.

Copy link
Member Author

Choose a reason for hiding this comment

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

then the default value specified at the top of the function is used for the lookup.

Copy link
Member

Choose a reason for hiding this comment

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

It look like the change to pass in bgp to bgp_show_route can result in NULL deference. See line 9039. Suggest that bgp_show_route handle case of NULL bgp pointer (by getting default instance if NULL)

Copy link
Member

Choose a reason for hiding this comment

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

shouldn't line 8078 result in an error message and return, and not run on with bgp == NULL

Copy link
Member

Choose a reason for hiding this comment

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

This pattern is repeated in a number of places -- all need to be fixed. Perhaps a subroutine is a good idea?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah I thought about adding bgp into the parameters for bgp_vty_find_and_parse_afi_safi_vrf and then I realized that I wanted to come back through after we've fixed up more of the cli so I can make sure I have the pattern right.

if (!idx)
{
vty_out (vty, "View/Vrf Specified: %s is unknown", argv[5]->arg);
return CMD_WARNING;
Copy link
Member

Choose a reason for hiding this comment

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

can the number be set as an index value ? idx_val ?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is probably wrong. I'll see what I can fix up.

Copy link
Member

@louberger louberger left a comment

Choose a reason for hiding this comment

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

A pedantic comment WRT vrf.h:
I think it would be best to

  1. define VRF_UNKNOWN as VRF_MAX and VRF_MAX be some less than 2^16-1
  2. that special values be defined above VRF_MAX
  3. that the config interface prevent config of >= VRF_MAX

@donaldsharp
Copy link
Member Author

@louberger To answer your question why MAX_INT -1? The VRF_UNKNOWN is MAX_INT so I couldn't use that value.

The use of this function was causing some confusion.  As
such let's add some documentation.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
When bgp_vty_find_and_parse_afi_safi_vrf detects
a invalidly named vrf, it warns the user.  There
is no need for the calling function to warn
again.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@NetDEF-CI
Copy link
Collaborator

Continous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-127/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

if (argv_find(argv, argc, "community-list", &idx))
{
const char *clist_number_or_name = argv[++idx]->arg;
if (++idx < argc && strmatch (argv[idx]->arg, "exact-match"))
Copy link
Member

Choose a reason for hiding this comment

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

argv[idx]->text

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

*
* The function returns the correct location in the parse tree for the
* last token found.
*/
Copy link
Member

Choose a reason for hiding this comment

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

1 . returns 0 if error.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed message.

@donaldsharp
Copy link
Member Author

donaldsharp commented Jan 26, 2017 via email

@NetDEF-CI
Copy link
Collaborator

Continous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-137/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

1 similar comment
@NetDEF-CI
Copy link
Collaborator

Continous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-137/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

This fix addresses these things:

1) Clean up documentation as requested
2) Fix a wrong search for "exact-match"
3) Fix possible crash.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@donaldsharp
Copy link
Member Author

@louberger I fixed the crash you noticed that could happen.

@NetDEF-CI
Copy link
Collaborator

Continous Integration Result: FAILED

See below for issues.
CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-140/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Get source and apply patch from patchwork: Successful

Building Stage: Failed

OmniOS amd64 build: Successful
CentOS6 amd64 build: Successful
NetBSD7 amd64 build: Successful
FreeBSD9 amd64 build: Successful
Ubuntu1204 amd64 build: Successful
FreeBSD10 amd64 build: Successful
Ubuntu1404 amd64 build: Successful
Debian8 amd64 build: Successful
FreeBSD11 amd64 build: Successful
OpenBSD60 amd64 build: Successful
NetBSD6 amd64 build: Successful
CentOS7 amd64 build: Successful
Fedora24 amd64 build: Successful

Ubuntu1604 amd64 build: Failed

Ubuntu1604 amd64 build: Unknown Log <log_configure.txt>
URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-140/artifact/CI014BUILD/ErrorLog/log_configure.txt
Ubuntu1604 amd64 build: Unknown Log <config.log>
URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-140/artifact/CI014BUILD/config.log/config.log
Ubuntu1604 amd64 build: No useful log found

@NetDEF-CI
Copy link
Collaborator

Continous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-140/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

Convert the idx to &idx to make our api more consistent

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@@ -260,9 +260,12 @@ bgp_vty_find_and_parse_afi_safi_vrf (struct vty *vty, struct cmd_token **argv, i
if (*vrf == VRF_UNKNOWN)
{
vty_out (vty, "View/Vrf specified is unknown: %s", vrf_name);
*idx = 0;
Copy link
Member

Choose a reason for hiding this comment

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

why set idx to null here? Isn't the return value of zero sufficient? For that matter, why do anything special here, the caller can check each of {afi, safi, vrf} as they see fit....

Copy link
Member Author

Choose a reason for hiding this comment

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

that is not setting it to null. I'm setting the value of what is pointed at to 0. Very different

Copy link
Member

Choose a reason for hiding this comment

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

sorry too many threads going on, was thinking about the next comment I was going to write on this (WRT bgp = NULL). the comment still applies, please read "why set *idx = 0 to here ..."

Copy link
Member Author

Choose a reason for hiding this comment

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

because it's the error case? We were unable to figure out what vrf was specified( the last line in the doc )

Add asserts to how I expect bgp_vty_find_and_parse_afi_safi
to be used.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@NetDEF-CI
Copy link
Collaborator

Continous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-145/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

@@ -237,6 +237,10 @@ bgp_vty_find_and_parse_afi_safi_vrf (struct vty *vty, struct cmd_token **argv, i
{
char *vrf_name = NULL;

assert (afi);
assert (safi);
assert (*vrf == VRF_UNKNOWN);
Copy link
Member

Choose a reason for hiding this comment

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

don't you mean != VRF_UNKNOWN?

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
@NetDEF-CI
Copy link
Collaborator

Continous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-146/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

@NetDEF-CI
Copy link
Collaborator

Continous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-148/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

@louberger louberger merged commit aceb228 into FRRouting:master Jan 27, 2017
@donaldsharp donaldsharp deleted the bgpafisafi branch November 30, 2017 14:46
cfra referenced this pull request in opensourcerouting/frr Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants