Skip to content

Commit

Permalink
Adding Drivenets Vendor support
Browse files Browse the repository at this point in the history
  • Loading branch information
davnerson-dn committed Feb 7, 2024
1 parent a110702 commit 47aff5e
Show file tree
Hide file tree
Showing 18 changed files with 1,634 additions and 365 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This is not an officially supported Google product.
## Goal

For network emulation, there are many approaches using VM's for emulation of a
hardware router. Arista, Cisco, Juniper, and Nokia have multiple implementations
hardware router. Arista, Cisco, Juniper, Drivenets, and Nokia have multiple implementations
of their network operating system and various generations of hardware emulation.
These systems are very good for most validation of vendor control plane
implementations and data plane for limited certifications. The idea of this
Expand Down
53 changes: 53 additions & 0 deletions deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ func (d *Deployment) event() *epb.Cluster {
c.Controllers = append(c.Controllers, epb.Cluster_CONTROLLER_TYPE_SRLINUX)
case *LemmingSpec:
c.Controllers = append(c.Controllers, epb.Cluster_CONTROLLER_TYPE_LEMMING)
case *CdnosSpec:
c.Controllers = append(c.Controllers, epb.Cluster_CONTROLLER_TYPE_CDNOS)
}
}
return c
Expand Down Expand Up @@ -1151,6 +1153,57 @@ func (i *IxiaTGSpec) Healthy(ctx context.Context) error {
return deploymentHealthy(ctx, i.kClient, "ixiatg-op-system")
}


func init() {
load.Register("Cdnos", &load.Spec{
Type: CdnosSpec{},
Tag: "controllers",
})
}

type CdnosSpec struct {
ManifestDir string `yaml:"manifests"`
Operator string `yaml:"operator" kne:"yaml"`
OperatorData []byte
kClient kubernetes.Interface
}

func (l *CdnosSpec) SetKClient(k kubernetes.Interface) {
l.kClient = k
}

func (l *CdnosSpec) Deploy(ctx context.Context) error {
if l.OperatorData != nil {
f, err := os.CreateTemp("", "cdnos-operator-*.yaml")
if err != nil {
return err
}
defer os.Remove(f.Name())
if _, err := f.Write(l.OperatorData); err != nil {
return err
}
if err := f.Close(); err != nil {
return err
}
l.Operator = f.Name()
}
if l.Operator == "" && l.ManifestDir != "" {
log.Errorf("Deploying Cdnos controller using the directory 'manifests' field (%v) is deprecated, instead provide the filepath of the operator file directly using the 'operator' field going forward", l.ManifestDir)
l.Operator = filepath.Join(l.ManifestDir, "manifest.yaml")
}
log.Infof("Deploying Cdnos controller from: %s", l.Operator)
if err := logCommand("kubectl", "apply", "-f", l.Operator); err != nil {
return fmt.Errorf("failed to deploy cdnos operator: %w", err)
}
log.Infof("Cdnos controller deployed")
return nil
}

func (l *CdnosSpec) Healthy(ctx context.Context) error {
return deploymentHealthy(ctx, l.kClient, "cdnos-controller-system")
}


func deploymentHealthy(ctx context.Context, c kubernetes.Interface, name string) error {
log.Infof("Waiting on deployment %q to be healthy", name)
w, err := c.AppsV1().Deployments(name).Watch(ctx, metav1.ListOptions{})
Expand Down
3 changes: 3 additions & 0 deletions deploy/kne/external-multinode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ controllers:
- kind: Lemming
spec:
operator: ../../manifests/controllers/lemming/manifest.yaml
- kind: Cdnos
spec:
operator: ../../manifests/controllers/cdnos/manifest.yaml
3 changes: 3 additions & 0 deletions deploy/kne/kind-bridge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,6 @@ controllers:
- kind: Lemming
spec:
operator: ../../manifests/controllers/lemming/manifest.yaml
- kind: Cdnos
spec:
operator: ../../manifests/controllers/cdnos/manifest.yaml
19 changes: 18 additions & 1 deletion docs/create_topology.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,16 @@ Field | Type | Description

Field | Type | Description
------ | --------- | ----------------------------------------------------
`kind` | string | Name of the controller type. The current options currently are `IxiaTG`, `SRLinux`, `CEOSLab`, and `Lemming`.
`kind` | string | Name of the controller type. The current options currently are `Cdnos`, `IxiaTG`, `SRLinux`, `CEOSLab`, and `Lemming`.
`spec` | yaml.Node | Fields that set the options for the controller type.

##### Cdnos

Field | Type | Description
--------------- | ---------- | -----------
`operator` | string | Path of the yaml file to create a Cdnos operator in the cluster. The validated operator for use with KNE can be found [here](https://github.com/openconfig/kne/tree/main/manifests/controllers/cdnos/manifest.yaml).
~~`manifests`~~ | ~~string~~ | ~~Path of the directory holding the manifests to create a CEOSLab operator in the cluster. The directory is expected to contain a file with the name `manifest.yaml`.~~

##### IxiaTG

Field | Type | Description
Expand Down Expand Up @@ -177,6 +184,7 @@ following vendors use a controller:
- Keysight: `ixiatg`
- Nokia: `srlinux`
- Arista: `ceoslab`
- Drivenets: `cdnos`
- OpenConfig: `lemming`

These controllers can be deployed as part of [cluster
Expand Down Expand Up @@ -224,6 +232,15 @@ kubectl apply -f manifests/controllers/ceoslab/manifest.yaml
See more on the
[arista-ceoslab-operator GitHub repo](https://github.com/aristanetworks/arista-ceoslab-operator).

### Cdnos Controller

```bash
kubectl apply -f manifests/controllers/cdnos/manifest.yaml
```

See more on the
[cdnos-controller GitHub repo](https://github.com/drivenets/cdnos-controller).

#### lemming

To manually apply the controller run the following command:
Expand Down
29 changes: 29 additions & 0 deletions examples/drivenets/cdnos.pb.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "cdnos-demo"
nodes: {
name: "cdnos1"
vendor: DRIVENETS
config: {
config_file: "default"
config_path: "/config_load"
file: "cdnos1.cfg"
image: "registry.dev.drivenets.net/devops/cdnos_dev_v19_1:19.1.0.101_dev.dev_v19_1"
}
model: "CDNOS"
}
nodes: {
name: "cdnos2"
vendor: DRIVENETS
config: {
config_file: "default"
config_path: "/config_load"
file: "cdnos2.cfg"
image: "registry.dev.drivenets.net/devops/cdnos_dev_v19_1:19.1.0.101_dev.dev_v19_1"
}
model: "CDNOS"
}
links: {
a_node: "cdnos1"
a_int: "eno0"
z_node: "cdnos2"
z_int: "eno0"
}
8 changes: 8 additions & 0 deletions examples/drivenets/cdnos1.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
configure
interfaces
ge10-0/0/0
ipv4-address 1.1.1.1/24
admin-state enabled
!
!
commit
8 changes: 8 additions & 0 deletions examples/drivenets/cdnos2.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
configure
interfaces
ge10-0/0/0
ipv4-address 1.1.1.2/24
admin-state enabled
!
!
commit
35 changes: 35 additions & 0 deletions examples/drivenets/multivendor-drivenets.pb.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "cdnos-multivendor-demo"
nodes: {
name: "srl1"
vendor: NOKIA
model: "ixr6e"
config:{
# when `image` is not specified under `config`, the "ghcr.io/nokia/srlinux:latest" container image is used by default
# SR Linux can accept both complete config files in JSON format, or partial/full config snippets in the CLI format.
# nodes are configured with a partial config snippet in CLI format that adds configuration relevant for this example lab.
file: "srlinux.cfg"
}
interfaces: {
key: "e1-1"
value: {
name: "ethernet-1/1"
}
}
}
nodes: {
name: "cdnos1"
vendor: DRIVENETS
config: {
config_path: "/config_load"
config_file: "default"
file: "cdnos2.cfg"
image: "registry.dev.drivenets.net/devops/cdnos_dev_v19_1:19.1.0.101_dev.dev_v19_1"
}
model: "CDNOS"
}
links: {
a_node: "srl1"
a_int: "e1-1"
z_node: "cdnos1"
z_int: "eno0"
}
1 change: 1 addition & 0 deletions examples/drivenets/srlinux.cfg
Loading

0 comments on commit 47aff5e

Please sign in to comment.