From 027455d67a35551d6779bcc14bcca39c5c6802a3 Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Wed, 24 Apr 2024 14:20:08 +0300 Subject: [PATCH 1/4] lift interface limit for sros --- nodes/vr_sros/vr-sros.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nodes/vr_sros/vr-sros.go b/nodes/vr_sros/vr-sros.go index 92f4b38e2..a6324b594 100644 --- a/nodes/vr_sros/vr-sros.go +++ b/nodes/vr_sros/vr-sros.go @@ -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/2 + ifRe := regexp.MustCompile(`eth([1-9]+|[1-9][0-9]+)$`) 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()) } } From e222df0ac2673b865949e4c0809d6837c263d4c8 Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Wed, 24 Apr 2024 14:38:38 +0300 Subject: [PATCH 2/4] use quoted formatter --- nodes/vr_sros/vr-sros.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes/vr_sros/vr-sros.go b/nodes/vr_sros/vr-sros.go index a6324b594..b2c30324e 100644 --- a/nodes/vr_sros/vr-sros.go +++ b/nodes/vr_sros/vr-sros.go @@ -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, ) From 1302bb213471b9370a1f621574602174bdc3bdc5 Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Wed, 24 Apr 2024 14:39:46 +0300 Subject: [PATCH 3/4] simpler check for empty config --- nodes/vr_sros/vr-sros.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nodes/vr_sros/vr-sros.go b/nodes/vr_sros/vr-sros.go index b2c30324e..77b240b09 100644 --- a/nodes/vr_sros/vr-sros.go +++ b/nodes/vr_sros/vr-sros.go @@ -253,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 } From 76a2dd0bdaac04ea18445876068367d1a8221837 Mon Sep 17 00:00:00 2001 From: Roman Dodin Date: Wed, 24 Apr 2024 14:40:14 +0300 Subject: [PATCH 4/4] simpler regex --- nodes/vr_sros/vr-sros.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nodes/vr_sros/vr-sros.go b/nodes/vr_sros/vr-sros.go index 77b240b09..1cfaffee2 100644 --- a/nodes/vr_sros/vr-sros.go +++ b/nodes/vr_sros/vr-sros.go @@ -189,8 +189,8 @@ func (s *vrSROS) CheckInterfaceName() error { // 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/2 - ifRe := regexp.MustCompile(`eth([1-9]+|[1-9][0-9]+)$`) + // 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 >=1", e.GetIfaceName())