Exemplo n.º 1
0
def get_ing_config_transceiver(session, index):
    module = MODULE
    submodule = "logical-channels/channel[index='{}']/ingress/config/transceiver".format(
        index)
    xpath = "/{}/{}".format(module, submodule)
    values = make_query(session, xpath)
    if values is None:
        return None
    s = values[0].split("transceiver = ")
    return s[1]
Exemplo n.º 2
0
def get_config_description(session, index):
    module = MODULE
    submodule = "logical-channels/channel[index='{}']/config/description".format(
        index)
    xpath = "/{}/{}".format(module, submodule)
    values = make_query(session, xpath)
    if values is None:
        return None
    s = values[0].split("description = ")
    return s[1]
Exemplo n.º 3
0
def get_index_interfaces(session):
    module = MODULE
    submodule = "logical-channels/channel[node()]/index"
    xpath = "/{}/{}".format(module, submodule)
    values = make_query(session, xpath, multi=True)
    ret = []
    for v in values:
        s = v.split("index = ")
        ret.append(s[1])
    return ret.copy()
Exemplo n.º 4
0
def get_component_state_type(session, name):
    module = MODULE
    submodule = "component[name='{}']/state/type".format(name)
    xpath = "/{}/{}".format(module, submodule)
    values = make_query(session, xpath)
    if values is None:
        return None
    s = values[0].split("type = ")
    t = s[1].split(":")
    return t[1]
Exemplo n.º 5
0
def get_lch_config_assignment_type(session, index):
    module = MODULE
    submodule1 = "logical-channels/channel[index='{}']".format(index)
    submodule2 = "logical-channel-assignments/assignment[index='{}']/config/assignment-type".format(
        index)
    xpath = "/{}/{}/{}".format(module, submodule1, submodule2)
    values = make_query(session, xpath)
    if values is None:
        return None
    s = values[0].split("assignment-type = ")
    return s[1]
Exemplo n.º 6
0
def get_config_frequency_vlan(session, name):
    module = MODULE
    submodule = "component[name='{}']/openconfig-terminal-device:optical-channel/config/frequency".format(
        name)
    xpath = "/{}/{}".format(module, submodule)
    values = make_query(session, xpath)
    s = values[0].split("frequency = ")
    f = s[1]
    v = None
    if f is not None:
        v = convert_freq_vlan(f.strip())
        return f, v
    return f, v
Exemplo n.º 7
0
def get_component_config_name(session):
    module = MODULE
    submodule = "component[node()]/config/name"
    xpath = "/{}/{}".format(module, submodule)
    values = make_query(session, xpath, multi=True)
    if values is None:
        return None
    ret = []
    for v in values:
        s = v.split("name = ")
        if "/" not in s[1]:
            ret.append(s[1])
    return ret.copy()