Workbook sample

This is a sample challenge from a full-scale lab of the DevNet Expert Masterclass.

All the features, libraries and platforms used in a lab challenge like this, would have been covered on previous lectures and workbook tasks.

Each of the 4 full-scale lab has between 6 and 10 different challenges each. All of them will be graded during the Masterclass, and individual feedback on your solutions will be provided.

This specific challenge 308 covers the following blueprint items:

Workbook-sample-challenge-306.pdf

The initial content of the mentioned 3 files is provided  below.

expertconf.py

import click

import requests

import json

requests.packages.urllib3.disable_warnings()

from jinja2 import Template

from ncclient import manager


class OspfRouter():

intf_type = None

intf_ip_addr = None

physical_intf_number = None

subintf_vlan = None


def render_netconf(self):

# Requirement C

netconf_data = ospf_netconf_template.render({

"intf_type": self.intf_type,

"physical_intf_number": self.physical_intf_number,

"subintf_vlan": self.subintf_vlan,

"intf_ip_addr": self.intf_ip_addr

})

return netconf_data


def render_restconf(self):

# Requirement C

restconf_data = ospf_restconf_template.render({"ospf": {

"intf_type": self.intf_type,

"physical_intf_number": self.physical_intf_number,

"subintf_vlan": self.subintf_vlan,

"intf_ip_addr": self.intf_ip_addr

}})

return restconf_data



@click.group()

def expertconf():

pass


@click.command()

# Requirement A

@click.option('--password', prompt=True, hide_input=True)

def ospf(router_address, username, ethsubintf, intfaddr, rfc, password):

router = OspfRouter()

# Requirement D

if rfc == "6241":

# Requirement E

# config = router.render.()

elif rfc == "8040":

# Requirement F

# config = router.render.()

rsp.raise_for_status()


# Requirement A


if __name__ == "__main__":

expertconf()

ospf-6241.j2

# Requirement B

ospf-8040.j2

# Requirement B