Skip to content

Commit 830d34d

Browse files
committed
Merge branch 'cvp-cert' into 'master'
adding cv cert based onboarding See merge request networkRob/rLab-eos!21
2 parents b4004d5 + 022b2da commit 830d34d

2 files changed

Lines changed: 38 additions & 7 deletions

File tree

Readme.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ topology:
7676
cvp-key: {CVP_KEY}
7777
username: {USERNAME}
7878
password: {PASSWORD}
79+
cv:
80+
nodes:
81+
- {CV_NODE}
82+
port: {CV_PORT}
83+
auth:
84+
cert: {CV_ONBOARDING_TOKEN}
85+
path: /mnt/flash
7986
infra:
8087
bridge: {MGMT_BRIDGE}
8188
gateway: {MGMT_NETWORK_GATEWAY}
@@ -107,8 +114,11 @@ iperf:
107114
commands:
108115
```
109116

110-
- The `CVP_IPADDRESS` parameter is optional, this is if a bare startup-config is created and the device should start streaming to CVP.
111-
- The `CVP_KEY` parameter is optional, this is if a bare startup-config is created and the device should start streaming to CVP.
117+
- The `CVP_IPADDRESS` parameter is optional, this is if a bare startup-config is created and the device should start streaming to CVP. (Deprecated)
118+
- The `CVP_KEY` parameter is optional, this is if a bare startup-config is created and the device should start streaming to CVP. (Deprecated)
119+
- The `CV_NODE` This paramter is to specity the address of the CV instance. Can be a list of Addresses
120+
- The `CV_PORT` This paramter is to specify the destination port for CV. On-Prem = `9910`, CVaaS = `443`
121+
- The `CV_ONBOARDING_TOKEN` This parameter is to be populated with a device enrollment token from CV
112122
- The `USERNAME` parameter is optional, this is if a bare startup-config is created. It will generate a local user account in EOS.
113123
- The `PASSWORD` parameter is optional, this is if a bare startup-config is created. It will generate the password for the local user account.
114124
- The `MGMT_BRIDGE` parameter is optional, this is if you wish to attach the cEOS containers Management0 Interface to this network.

build/topo-builder.py

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,13 @@ def main(args):
234234
"""
235235
BASE_TERMINATTR = """
236236
daemon TerminAttr
237-
exec /usr/bin/TerminAttr -cvaddr={0}:9910 -taillogs -cvcompression=gzip -cvauth=key,{1} -smashexcludes=ale,flexCounter,hardware,kni,pulse,strata -ingestexclude=/Sysdb/cell/1/agent,/Sysdb/cell/2/agent
237+
exec /usr/bin/TerminAttr -cvaddr={0} -taillogs -cvcompression=gzip -cvauth={1} -smashexcludes=ale,flexCounter,hardware,kni,pulse,strata -ingestexclude=/Sysdb/cell/1/agent,/Sysdb/cell/2/agent
238238
no shutdown
239239
!
240240
"""
241241
BASE_TERMINATTR_VRF = """
242242
daemon TerminAttr
243-
exec /usr/bin/TerminAttr -cvaddr={0}:9910 -cvvrf={2} -taillogs -cvcompression=gzip -cvauth=key,{1} -smashexcludes=ale,flexCounter,hardware,kni,pulse,strata -ingestexclude=/Sysdb/cell/1/agent,/Sysdb/cell/2/agent
243+
exec /usr/bin/TerminAttr -cvaddr={0} -cvvrf={2} -taillogs -cvcompression=gzip -cvauth={1} -smashexcludes=ale,flexCounter,hardware,kni,pulse,strata -ingestexclude=/Sysdb/cell/1/agent,/Sysdb/cell/2/agent
244244
no shutdown
245245
!
246246
"""
@@ -333,6 +333,16 @@ def main(args):
333333
pS("INFO", "Leveraging default dataplane")
334334
except:
335335
pS("INFO", "Leveraging default dataplane")
336+
# Check for new CV section
337+
if 'cv' in topo_yaml:
338+
try:
339+
cv_nodes = f":{topo_yaml['cv']['port']},".join(topo_yaml['cv']['nodes'])
340+
cv_nodes = f"{cv_nodes}:{topo_yaml['cv']['port']}"
341+
cv_auth = f"token,{topo_yaml['cv']['auth']['path']}/token"
342+
cv_token = topo_yaml['cv']['auth']['cert']
343+
except:
344+
pS("INFO", "New CV schema not formatted correctly")
345+
cv_nodes = False
336346

337347
# Load and Gather network Link information
338348
pS("INFO", "Gathering patch cable lengths and quantities...")
@@ -468,11 +478,22 @@ def main(args):
468478
_tmp_startup.append(BASE_MGMT_VRF.format(CEOS[_node].ip, topo_yaml['infra']['gateway'], mgmt_vrf))
469479
else:
470480
_tmp_startup.append(BASE_MGMT.format(CEOS[_node].ip, topo_yaml['infra']['gateway']))
471-
if 'cvpaddress' and 'cvp-key' in topo_yaml['topology']:
481+
# Perform eval based on CV schema
482+
if cv_nodes:
472483
if mgmt_vrf != "default":
473-
_tmp_startup.append(BASE_TERMINATTR_VRF.format(topo_yaml['topology']['cvpaddress'], topo_yaml['topology']['cvp-key'], mgmt_vrf))
484+
_tmp_startup.append(BASE_TERMINATTR_VRF.format(cv_nodes, cv_auth, mgmt_vrf))
474485
else:
475-
_tmp_startup.append(BASE_TERMINATTR.format(topo_yaml['topology']['cvpaddress'], topo_yaml['topology']['cvp-key']))
486+
_tmp_startup.append(BASE_TERMINATTR.format(cv_nodes, cv_auth))
487+
# Copy CV Cert info to startup config
488+
create_output.append('echo "{0}" > {1}/{2}/{3}/token\n'.format(cv_token, CONFIGS, _tag, _node))
489+
else:
490+
if 'cvpaddress' and 'cvp-key' in topo_yaml['topology']:
491+
if mgmt_vrf != "default":
492+
_cv_node = f"{topo_yaml['topology']['cvpaddress']}:9910"
493+
_cv_auth = f"key,{topo_yaml['topology']['cvp-key']}"
494+
_tmp_startup.append(BASE_TERMINATTR_VRF.format(_cv_node, _cv_auth, mgmt_vrf))
495+
else:
496+
_tmp_startup.append(BASE_TERMINATTR.format(_cv_node, _cv_auth))
476497
create_output.append('echo "{0}" > {1}/{2}/{3}/startup-config\n'.format(''.join(_tmp_startup), CONFIGS, _tag, _node))
477498
# Creating anchor containers
478499

0 commit comments

Comments
 (0)