Ejemplo n.º 1
0
    mgmt_bridge: "{{ mgmt_bridge }}"
'''

DEFAULT_MTU = 0
NUM_FP_VLANS_PER_FP = 4
VM_SET_NAME_MAX_LEN = 8  # used in interface names. So restricted
CMD_DEBUG_FNAME = "/tmp/ceos_network.cmds.%s.txt"

OVS_FP_BRIDGE_REGEX = 'br-%s-\d+'
OVS_FP_BRIDGE_TEMPLATE = 'br-%s-%d'
FP_TAP_TEMPLATE = '%s-t%d'
BP_TAP_TEMPLATE = '%s-back'
MGMT_TAP_TEMPLATE = '%s-m'
INT_TAP_TEMPLATE = 'eth%d'

config_module_logging('ceos_network')


class CeosNetwork(object):
    """This class is for creating CEOS network.

    This creates veth pairs and add one of the veth interface to the CEOS network docker. The external veth interface
    is added to corresponding bridges.

    """
    def __init__(self, ctn_name, vm_name, mgmt_br_name, fp_mtu, max_fp_num):
        self.ctn_name = ctn_name
        self.vm_name = vm_name
        self.fp_mtu = fp_mtu
        self.max_fp_num = max_fp_num
        self.mgmt_br_name = mgmt_br_name
Ejemplo n.º 2
0
#!/usr/bin/python

from telnetlib import Telnet
import logging
from ansible.module_utils.debug_utils import config_module_logging

def encode(arg):
    if (sys.version_info.major == 3 and sys.version_info.minor >= 5):
        return arg.encode("ascii")
    else:
        return arg

config_module_logging('kickstart')

class EMatchNotFound(Exception):
    pass


class ELoginPromptNotFound(Exception):
    pass


class EWrongDefaultPassword(Exception):
    pass


class ENotInEnabled(Exception):
    pass


class SerialSession(object):
Ejemplo n.º 3
0
from operator import itemgetter
from itertools import groupby
from collections import defaultdict
from natsort import natsorted

try:
    from ansible.module_utils.port_utils import get_port_alias_to_name_map
    from ansible.module_utils.debug_utils import config_module_logging
except ImportError:
    # Add parent dir for using outside Ansible
    import sys
    sys.path.append('..')
    from module_utils.port_utils import get_port_alias_to_name_map
    from module_utils.debug_utils import config_module_logging

config_module_logging('conn_graph_facts')

DOCUMENTATION = '''
module: conn_graph_facts.py
version_added:  2.0
short_description: Retrive lab fanout switches physical and vlan connections
Description:
    Retrive lab fanout switches physical and vlan connections
    add to Ansible facts
options:
    host:
        [fanout switch name|Server name|Sonic Switch Name]
        required: False
    hosts:
        List of hosts. Applicable for multi-DUT and single-DUT setup. The host option for single DUT setup is kept
        for backward compatibility.
Ejemplo n.º 4
0
#!/usr/bin/python

from telnetlib import Telnet
import logging
from ansible.module_utils.debug_utils import config_module_logging

config_module_logging('sonic_kickstart')


class EMatchNotFound(Exception):
    pass


class SerialSession(object):
    def __init__(self, port):
        logging.debug('Starting')
        self.tn = Telnet('127.0.0.1', port)
        self.tn.write(b"\r\n")

        return

    def __del__(self):
        self.cleanup()

        return

    def cleanup(self):
        if self.tn:
            self.tn.close()
            self.tn = None