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

Lift interface limit for sros #2012

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions nodes/vr_sros/vr-sros.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (s *vrSROS) Init(cfg *types.NodeConfig, opts ...nodes.NodeOption) error {
s.Cfg.Binds = append(s.Cfg.Binds, "/dev:/dev")
}

s.Cfg.Cmd = fmt.Sprintf("--trace --connection-mode %s --hostname %s --variant \"%s\"", s.Cfg.Env["CONNECTION_MODE"],
s.Cfg.Cmd = fmt.Sprintf("--trace --connection-mode %s --hostname %s --variant %q", s.Cfg.Env["CONNECTION_MODE"],
s.Cfg.ShortName,
s.Cfg.NodeType,
)
Expand Down Expand Up @@ -186,12 +186,14 @@ func (s *vrSROS) SaveConfig(_ context.Context) error {

// CheckInterfaceName checks if a name of the interface referenced in the topology file correct.
func (s *vrSROS) CheckInterfaceName() error {
// vsim doesn't seem to support >20 interfaces, yet we allow to set max if number 32 just in case.
// https://regex101.com/r/bx6kzM/1
ifRe := regexp.MustCompile(`eth([1-9]|[12][0-9]|3[0-2])$`)
// vsim doesn't seem to support >30 interfaces on a single line card,
// but since we use a througout enumeration for the multi line card depployment
// we allow any number of interfaces
// https://regex101.com/r/bx6kzM/3
ifRe := regexp.MustCompile(`eth([1-9]+|[1-9]\d+)$`)
for _, e := range s.Endpoints {
if !ifRe.MatchString(e.GetIfaceName()) {
return fmt.Errorf("nokia SR OS interface name %q doesn't match the required pattern. SR OS interfaces should be named as ethX, where X is from 1 to 32", e.GetIfaceName())
return fmt.Errorf("nokia SR OS interface name %q doesn't match the required pattern. SR OS interfaces should be named as ethX, where X is >=1", e.GetIfaceName())
}
}

Expand Down Expand Up @@ -251,7 +253,7 @@ func (s *vrSROS) applyPartialConfig(ctx context.Context, addr, platformName,
}

// check file contains content, otherwise exit early
if len(strings.TrimSpace(string(configContent))) == 0 {
if strings.TrimSpace(string(configContent)) == "" {
return nil
}

Expand Down
Loading