Page MenuHomeVyOS Platform

"set interfaces" Python handler code improvements - next iteration
Closed, ResolvedPublicFEATURE REQUEST

Description

Moving the INterface configuration code from VyOS 1.2 to 1.3 it already passed two or three (depending on how you count) iteration cycles. In the beginning I did a PoC using python-iproute2 which very fast showed its limited use in VyOS thus a "general" abstraction was created called "vyos.ifconfig". This was again refactored and restructured by @thomas-mangin to reduce duplicated code and make it more reusable.

This changed was only a change from the inside of this library and the calling code was almost of no change. By adding new functionalities like VRF the design again showed its still not ideal and as I wanted it to be in the end. More and more errors arised by copy/apsting code between classes to configure all kind of interface stuff.

Current Design

Some but not all poor design decisions (I guess I have introduced them all?)

  • Every class (interface-{ethernet, dummy, bridge..}) calls Interface().set_alias() or add_addr()
  • Every class needs to manually escape sequences "what can be changed when interface is online, what can only be done if interface is admin down?"

The former beeing one of the worst designs - duplicated code. The following picture shows who are the offenders calling Interface() class, every caller duplicates most of the code

New Design

The general Interface() class is still used with all its internal functions but while moving towards get_config_dict() based implementation a summerisation function Interface().update() is added which takes a config dict as its argument.
Thus general settings which are done for each and every interface can be rewritten at a single location and reused from now on.

Other "special" implementations required for e.g. bond or bridge interfaces, should happen in its derived class overwriting the update() function. Thus adding new features will become much easier as it only needs to be added in very few places.

One could also think of a helper class called by verify() which does some basic checking (VRF for instance) further reducing the amount of duplicated code.

Rules

As this is a possible candidate to really fuck up things, for each change there must be a proper test available in vyos-smoketest first so we stop "bad" ISO images from getting out into the wild.

Details

Difficulty level
Hard (possibly days)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Behavior change

Related Objects

StatusSubtypeAssignedTask
OpenFEATURE REQUESTNone
ResolvedFEATURE REQUESTc-po
Resolvedc-po
ResolvedBUGc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
ResolvedBUGc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
ResolvedBUGc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
OpenFEATURE REQUESTNone
ResolvedENHANCEMENTc-po
ResolvedFEATURE REQUESTc-po
ResolvedFEATURE REQUESTc-po
Resolvedc-po

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
c-po changed the task status from In progress to Needs testing.Jul 25 2020, 3:53 PM
c-po changed the status of subtask T2733: Support MTU configuration on pseudo ethernet devices from Open to In progress.Jul 26 2020, 7:44 AM
c-po changed the status of subtask T2734: WireGuard: fwmark CLI definition is inconsistent from Open to Backport candidate.Jul 26 2020, 11:17 AM
c-po changed the status of subtask T2746: IPv6 link-local addresses not configured from Open to In progress.Jul 30 2020, 9:12 PM
c-po changed the status of subtask T2904: 802.1ad / Q-in-Q ethertype default not utilized from Open to In progress.Sep 20 2020, 11:04 AM
c-po changed the status of subtask T2905: Sync CLI nodes between PPPoE and WWAN interface from Open to In progress.Sep 20 2020, 11:08 AM
c-po changed the status of subtask T2985: Add glue code to create bridge interface on demand from Open to In progress.Oct 17 2020, 9:59 AM
c-po changed the status of subtask T2985: Add glue code to create bridge interface on demand from In progress to Needs testing.Oct 17 2020, 8:55 PM
c-po changed the status of subtask T2994: Migrate OpenVPN interfaces to get_config_dict() syntax from In progress to Needs testing.Fri, Oct 30, 8:14 PM
c-po changed the status of subtask T3043: Wireless: Refactor CLI from Open to In progress.Tue, Nov 3, 4:38 PM
c-po closed this task as Resolved.Sat, Nov 7, 7:43 PM
c-po moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.Mon, Nov 23, 5:22 PM