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

Implement FWaaS for ASR1k #106

Merged
merged 31 commits into from
Sep 16, 2024
Merged

Implement FWaaS for ASR1k #106

merged 31 commits into from
Sep 16, 2024

Commits on Aug 12, 2024

  1. Add FWaaS service provider stub

    If specified as a service_provider for FIREWALL_V2 the ASR1KFWaaSDriver
    will receive all pre/postcommit hooks necessary to implement the
    OpenStack FWaasV2 service.
    sebageek authored and swagner-de committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    925084b View commit details
    Browse the repository at this point in the history
  2. Checkin FWaaS config draft

    swagner-de committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    a4d4112 View commit details
    Browse the repository at this point in the history
  3. Implement FWaaS CRUD hooks

    swagner-de committed Aug 12, 2024
    Configuration menu
    Copy the full SHA
    3fb11c3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    cd311b3 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    65d2b48 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    1992a9a View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    3b43732 View commit details
    Browse the repository at this point in the history

Commits on Aug 13, 2024

  1. Add policy update to router sync

    fwg policies are shared objects, they can be used by multiple routers.
    We map them 1:1 to ACL objects on IOS XE and thus need a method to keep
    them updated. We could do that by calling a router sync on any single
    router that has a reference to that policy or we just call it on an
    arbitrary router on every agent. This is what we implement in this
    commit.
    swagner-de committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    a82b77a View commit details
    Browse the repository at this point in the history
  2. Extend API to return gateway port id on router object

    In our FWaaS implementation we will most likely bind policies on
    external interfaces. In order to tell the customer the external
    interface we expand the API to convey this information.
    swagner-de committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    753edf3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    705b5df View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0709e83 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    91fc300 View commit details
    Browse the repository at this point in the history
  6. Create interface RII and zone-membership if external policy present

    In order for the ZBF feature to replicate the state table, interfaces
    need to be assigned to a redundandancy group and receive a Redundant
    Interface Identifier (RII) in order to find the same interface on the
    remote side. In case we find an external policy on the `Router`, we
    mark all interfaces on the router's interface list with
    `has_stateful_firewall`. If that is the case, we instantiate the yang
    model with RII, redundancy group membership and in case of the interface
    being the gateway interface with an zone membership. As this marking is
    done post `Interface` instantiation, we make the `_rest_definition`
    attribute a dynamic property, so later changes in the `Interface` object
    are represented in its `_rest_definition`.
    swagner-de committed Aug 13, 2024
    Configuration menu
    Copy the full SHA
    b75d7ab View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    7279d5d View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2024

  1. Implement fake stateful rules

    As we cannot support hardware stateful firewalling, we mimic stateful
    behaviour by inserting a set of rules of the beginning of each ACL that
    help us letting  through packets that are usually an answer to a sent
    out packet.
    swagner-de committed Aug 16, 2024
    Configuration menu
    Copy the full SHA
    8d36ded View commit details
    Browse the repository at this point in the history

Commits on Aug 28, 2024

  1. Make is_orphan in subclasses generic

    All netconf_yang classes inherit their `is_orphan` from BulkOperations.
    Each of these subclasses need different lists to determine if the
    classes object is orphan or not. Let's simplify adding arguments to this
    method by using keyword arguments. All subclasses shall send unnecessary
    arguments to `*args, **kwargs` while only `BulkOperations.is_orphan`
    should know about the whole argument list.
    swagner-de committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    513c985 View commit details
    Browse the repository at this point in the history
  2. Implement deletion of FWaaS router specific objects

    Zones and ZonePairs are created per VRF that has an external policy
    attached. We can remove them straigh away once the external policy was
    removed on an VRF/external router interface.
    swagner-de committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    f6baf22 View commit details
    Browse the repository at this point in the history
  3. Add diff to FWaaS objects

    swagner-de committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    859c338 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    f4549a7 View commit details
    Browse the repository at this point in the history
  5. Add API to retrieve router centric view of firewall rules

    FWaaS rules are mapped via policies and firewall groups to ports. Yet
    when we need to troubelshoot, we must compare it to a virtual router's
    configuration, so we'd need easy access to how the rules would look from
    a router interface perspective. This commit adds an API endpoint that
    delivers that view, removing some cluttering attributes from the result.
    swagner-de committed Aug 28, 2024
    Configuration menu
    Copy the full SHA
    b46fd9d View commit details
    Browse the repository at this point in the history

Commits on Sep 2, 2024

  1. Configuration menu
    Copy the full SHA
    576f2c7 View commit details
    Browse the repository at this point in the history
  2. Be more certain that connections are marked alive before loopingcalls

    I noticed that the first iterations of all loopingcalls would always
    fail. Turns out, `_run_yang_cmd` checks the `alive` condition of the
    context, which is not set until `device_check_loop` has run the first
    time. To make matters worse, `device_check_loop` is also the last
    loopingcall to be triggered, so it's certain that the first iteration
    off all previous calls will fail.
    
    I moved the loopingcall to be the first one triggered and also halt
    until we see the agents marked alive. I believe that makes sense as no
    yang action can be run before this happens either way. As I don't want
    to inhibit agent startup alltogether, I still back out after
    `nc_timeout`.
    swagner-de committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    4be5662 View commit details
    Browse the repository at this point in the history
  3. Implement cleanup loop for FWAAS objects not tied to a router

    Firewall policies can be bound to multiple ports. They are realized by
    ACLs, a ClassMap and a ServicePolicy (if the policy is bound to an
    external interface). That means, just because a router or a port is
    removed from a policy the corresponding objects may still be used from
    other routers. Hence it is not removed immediatly but by a cleanup loop,
    that checks if anybody on an agent is using that policy and then it will
    be removed.
    swagner-de committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    c5a20f7 View commit details
    Browse the repository at this point in the history
  4. Move FWAAS object prefixes into const module

    This prevents cyclic imports as the prefix is needed in the orphan
    check, but also needed when creating the object through one of the
    higher level l3 classes.
    swagner-de committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    ba06e5d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    36e953c View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b44fe23 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    65b8b88 View commit details
    Browse the repository at this point in the history
  8. Reorganize Access List rule creation

    To remove clutter from the AccessList class we move all the code that
    generates the attributes for the corresponding yang class into `Rule`.
    swagner-de committed Sep 2, 2024
    Configuration menu
    Copy the full SHA
    4ec01b6 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2024

  1. Resolve diamond shaped inheritance

    In the previous implementation `firewall.AccessList` would inherit from
    `l3.AccessList` which inherited from `base.Base`.
    `firewall.AccessList` also inherited from
    `firewall.FirewallPolicyObject`. That lead to a Diamond Shaped
    inheritance. The fact that `FirewallPolicyObject` and `l3.AccessList`
    had constructors with different arguments made it difficult to let
    `super()` call the constructors with different arguments.
    
    To resolve that, the diamond Shaped inheritance was resolved making it
    clearer which `__init__`'s `super()` calls which superclasses
    constructor.
    
    The different signatures of the constructor still pose a problem, hence
    we send all supplemental arguments of a constructor to `**kwargs`.
    swagner-de committed Sep 3, 2024
    Configuration menu
    Copy the full SHA
    64f5eba View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    07dc92f View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2024

  1. Configuration menu
    Copy the full SHA
    ad8c11d View commit details
    Browse the repository at this point in the history