-
Notifications
You must be signed in to change notification settings - Fork 659
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
Add interface name type with regex pattern constraint #1092
Conversation
No major YANG version changes in commit 8c74cff |
I think interface-refs already have a strict definition. Am I missing something? public/release/models/interfaces/openconfig-interfaces.yang Lines 181 to 207 in 0ae6953
|
I've updated the regex and description to show the suffix representing subinterface as optional. This was discussed in the 2024-04-16 OC operators meeting. It is observed that interface names are a very long standing area with a loose specification by design to allow for varied implementations, especially when it comes to media, hardware hierarchy and human readable names. There is some concern that we should understand what operational problems we are making better and weigh this against the cost of any change which is widespread in the models. Comments about the problem we are solving, particularly in a network operational context are needed to move this forward. |
@@ -197,6 +204,18 @@ module openconfig-interfaces { | |||
name and subinterface index."; | |||
} | |||
|
|||
typedef interface-full-id { | |||
type string { | |||
pattern '([^.]+)(\.[0-9]+)?'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the most part I think we are probably ok on common "system-defined" physical/logical/virtual interface naming across network vendor implementations but this excludes any interface name that may carry a .
unless the interface has no subinterface and encodes an integer post a single .
(which is also legal linux netdev naming)
$ cat interfaces.txt
et-0/0/0
et-0/0/0.0
et-0/0/0.1024
et-0/0/0:0.0
et-0/0/0:0.1024
ae0
ae0.0
ae0_0
TenGigabitEthernet0/0/0
TenGigabitEthernet0/0/0.0
mgmt0
mgmt0.0
Foo Bar Car
Foo Bar Car.1024
Foo Bar Car.1024.10
Foo/Bar/Car
Foo/Bar/Car:0
Foo/Bar/Car:0.100
Foo.Bar.Car/Jar
Foo.Bar.Car/Jar.100
Foo.Bar.Car/Jar.100
10/1/12
foo.1.2.3
foo.bar:0
foo.bar:0.0
$ cat interfaces.txt | grep -vE "^([^.]+)(\.[0-9]+)?$"
Foo Bar Car.1024.10
Foo.Bar.Car/Jar
Foo.Bar.Car/Jar.100
Foo.Bar.Car/Jar.100
foo.1.2.3
foo.bar:0
foo.bar:0.0
Maybe less of an issue for system-defined names but user-defined names (think virtual tunnels, etc..) now put a constraint on what the user can name an interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To entertain this idea a bit more, a robust way to be very permissive on interface names could be to replace the single string interface-id
with a strongly typed model representation with two leafs:
- interface-name type string
- Optional, sub-interface-index type uint32
Thinking a bit about how to model this in yang, we could add/replace each leaf which uses the interface-id type with the above two leaves. Today typedef interface-id
is present in 17 leafs which at a glance all relate some configuration to an interface.
I am not sure it's worth the churn in the model to make a change like this and would like to hear what the issues are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a problem with subinterface references that was not solved in #802 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am a bit confused - it seems what you are proposing is not much different than the interface-ref-common
grouping:
But the problem trying to be solved here was the fact that we have a single leaf node key used in a list somewhere that is either completely user-defined (made up objects that can differ all over each use) or we use a typedef with some set of rules behind it to drive consistency in the list key naming per implementation.
Those "rules" are either gated by a pattern (which is likely too restrictive or too loose) or a very descriptive description stmt on an YANG unbounded string.
Now, this could be combined into the above grouping so that a common grouping of a list and child nodes (the ultimate distinct leafrefs) can be used and reapplied but this is primarily about ensuring that a key used to reference back to an interface (or subinterface combo) is consistent across all usage in each domain.
It's not about consistency across implementations but a set of rules within the same implementation at least.
Do you have examples of unqualified interface names that you are trying to avoid by doing this? |
I'll close this PR as I don't have an example of implementations of interface leaf references which are causing a problem. If the community identifies this, we can reopen. |
Change Scope
See also #573 for content on naming of subinterfaces.
See also #802 which clarifies the use of
interface-id
See also openconfig/featureprofiles#2853 for a test referencing the value of the
interface-id
field.