Learning Lab: Settings

Related: Send HTTP requests to the Controller using CLI.

Introduction

This page describes the configuration and settings of the Learning Lab.

Topics:

  • How the configuration module is identified.
  • Where the configuration module is located.
  • View the configuration data.
  • Verify the connection to the Controller
  • Verify the connection to each network device

Table of Contents

Scripts

00_settings.py

Documentation


In [11]:
help('learning_lab.00_settings')


Help on module learning_lab.00_settings in learning_lab:

NAME
    learning_lab.00_settings - Display configuration settings.

DESCRIPTION
    Print the documentation of the 'settings' module.
    Print the location of the module the configuration is loaded from.
    Print the configuration data, including the co-ordinates of the Controller and network devices.

FILE
    /home/virl/git/cosc-learning-labs/src/learning_lab/00_settings.py


Run


In [12]:
run ../learning_lab/00_settings.py


Python Library Documentation: package settings

NAME
    settings - Obtain settings by dynamically loading a configuration module located in package 'settings'.

DESCRIPTION
    The configuration module is a normal Python module.
    The configuration module is located in package 'settings' (this package).
    The configuration module must have a variable named 'config', 
    The name of the configuration module is determined by environment variable NETWORK_PROFILE.
    The default configuration module is 'learning_lab.py'.
    The variable named 'config' in the configuration modules is assigned to the
    variable named 'config' in package 'settings' (this package).
    That is:
        settings.config = settings.<configuration_module>.config
    This redirection provides independence.
    Configuration data is accessed in a consistent manner (from 'settings.config').
    Sample Usage:
        import settings
        print(settings.config['odl_server']['address'])

PACKAGE CONTENTS
    3-XRv
    4-XRv
    Milan
    all_xr_versions
    dcloud
    empty
    giles
    jenkins
    learning_lab
    sandbox

SUBMODULES
    network_settings_module

DATA
    config = {'network_device': {'xrvr-1': {'address': '172.16.1.76', 'pas...

FILE
    /home/virl/git/cosc-learning-labs/src/settings/__init__.py


os.environ['NETWORK_PROFILE']:
     <empty>

settings.config.network_settings_module:
     <module 'settings.all_xr_versions' from '/home/virl/git/cosc-learning-labs/src/settings/all_xr_versions.py'>

settings.config:
    odl_server:
         port = 8181
         address = 127.0.0.1
         password = admin
         username = admin
    network_device:
        xrvr-2
             port = 830
             address = 172.16.1.75
             password = cisco
             username = cisco
        xrvr-1
             port = 830
             address = 172.16.1.76
             password = cisco
             username = cisco

00_controller.py

Documentation


In [13]:
help('learning_lab.00_controller')


Help on module learning_lab.00_controller in learning_lab:

NAME
    learning_lab.00_controller - Connect to the Controller.

DESCRIPTION
    Establish a connection to the Controller and display relevant information.

FILE
    /home/virl/git/cosc-learning-labs/src/learning_lab/00_controller.py


Run


In [14]:
run ../learning_lab/00_controller


client ('127.0.0.1', 46681) --> controller ('127.0.0.1', 8181)

00_devices.py

Documentation


In [15]:
help('learning_lab.00_devices')


Help on module learning_lab.00_devices in learning_lab:

NAME
    learning_lab.00_devices - Connect to each Network Device.

DESCRIPTION
    Establish a connection to the each network device and display relevant information.

FILE
    /home/virl/git/cosc-learning-labs/src/learning_lab/00_devices.py


Run


In [16]:
run ../learning_lab/00_devices


xrvr-2 ('172.16.1.254', 48555) --> ('172.16.1.75', 830)
xrvr-1 ('172.16.1.254', 41618) --> ('172.16.1.76', 830)

Conclusion

This page has explored the configuration and settings of the Learning Lab.

Achievements:

  • Discovered the configuration module name and location.
  • Displayed the configuration data.
  • Verified the connection to the Controller
  • Verified the connection to each network device