Exemple #1
0
def _get_interface_ports_interfaces(iprofile, interface):

    interface.ports = None
    interface.interfaces = None
    if interface.iftype != 'vlan' and interface.iftype != 'ae':
        ports = iprofile.ports
        if ports and hasattr(ports[0], 'interface_uuid'):
            port_list = [ethernetport_utils.get_port_display_name(p)
                         for p in ports if p.interface_uuid and p.interface_uuid == interface.uuid]
        else:
            port_list = [ethernetport_utils.get_port_display_name(p)
                         for p in ports if p.interface_id and p.interface_id == interface.id]
        interface.ports = port_list

    else:
        interfaces = iprofile.interfaces
        interface_list = [i.ifname for i in interfaces if i.ifname in interface.uses]
        interface.interfaces = interface_list
Exemple #2
0
def get_portconfig(iprofile):
    pstr = ''
    for port in iprofile.ports:
        pstr = pstr + "%s: %s" % (ethernetport_utils.get_port_display_name(port), port.pdevice)
        port.autoneg = 'Yes'  # TODO(jkung) Remove when autoneg supported in DB
        if port.autoneg != 'na':
            pstr = pstr + " | Auto Neg = %s" % (port.autoneg)
        if port.bootp:
            pstr = pstr + " | bootp-IF"
        pstr = pstr + '\n'

    return pstr