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

Router objects with BGP enabled are incorrectly validated when used on multiple DPs #3517

Open
gizmoguy opened this issue Apr 15, 2020 · 0 comments
Labels

Comments

@gizmoguy
Copy link
Member

When a check_config() is called on a Router object, the type of neighbor_addresses and server_addresses changes from list to frozenset:

    def check_config(self):
.....
            for field in self.ipaddress_fields:
                if field in self.bgp:
                    self.bgp[field] = frozenset([
                        self._check_ip_str(ip_str) for ip_str in self.bgp[field]])

This trips up if check_config() is called again on the same Router object:

[InvalidConfigError("DP swdev: server_addresses value frozenset({IPv4Address('127.0.0.1')}) must be <class 'list'> not <class 'frozenset'>")]

A terrible fix could be updating the type when we encapsulate it in frozenset() but it seems like there could be a better fix:

diff --git a/faucet/router.py b/faucet/router.py
index 4b6b44ce..33acb6cd 100644
--- a/faucet/router.py
+++ b/faucet/router.py
@@ -84,6 +84,7 @@ class Router(Conf):
                 if field in self.bgp:
                     self.bgp[field] = frozenset([
                         self._check_ip_str(ip_str) for ip_str in self.bgp[field]])
+                    self.bgp_defaults_types[field] = frozenset
             for accessor_val, required_field in (
                     (self.bgp_ipvs(), 'server_addresses'),
                     (self.bgp_as(), 'as'),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant