Esempio n. 1
0
def set_media_transceiver(interface_obj):
    # get front panel port from ifindex
    if_obj = cps_object.CPSObject(obj=interface_obj)
    npu = if_obj.get_attr_data('base-if-phy/if/interfaces/interface/npu-id')
    port = if_obj.get_attr_data('base-if-phy/if/interfaces/interface/port-id')
    print "set_media_transceiver for %d %d " % (npu, port)
    enable = if_obj.get_attr_data('if/interfaces/interface/enabled')
    port_list = nas_if.nas_os_phy_list(d={'npu-id': npu, 'port-id': port})
    phy_obj = cps_object.CPSObject(obj=port_list[0])
    fanout = phy_obj.get_attr_data('fanout-mode')
    try:
        hwport = phy_obj.get_attr_data('hardware-port-id')
        fp_details = fp.find_port_by_hwport(npu, hwport)
    except:
        print " Error in setting media Transceiver for ", if_obj.get_attr_data(
            'name')
        return
    # set media transceiver using media Id and channel ID
    # in case of 40G mode all channels should be enabled/disabled
    #  else only one channel.
    #
    print "fanout " + str(fanout)
    if fanout == 2:  # then it is in 4x10G fanout mode BASE_PORT_BREAKOUT_MODE_BREAKOUT_4X1
        _lane = fp_details.lane
    else:  # non-fanout mode 1x40g mode
        _lane = None  # enable/disable all channels. Do not pass Lane #
    media.media_transceiver_set(1, fp_details.media_id, _lane, enable)
Esempio n. 2
0
def set_media_transceiver(interface_obj):
    # get front panel port from ifindex
    if_obj = cps_object.CPSObject(obj=interface_obj)
    npu = if_obj.get_attr_data('base-if-phy/if/interfaces/interface/npu-id')
    port = if_obj.get_attr_data('base-if-phy/if/interfaces/interface/port-id')
    enable = if_obj.get_attr_data('if/interfaces/interface/enabled')
    nas_if.log_info("set_media_transceiver as " + str(enable) + " for " +
                    str(npu) + " , " + str(port))
    port_list = nas_if.nas_os_phy_list(d={'npu-id': npu, 'port-id': port})
    phy_obj = cps_object.CPSObject(obj=port_list[0])
    try:
        hwport_list = phy_obj.get_attr_data('hardware-port-list')
    except:
        nas_if.log_err(" Error in setting media Transceiver for %s" %
                       if_obj.get_attr_data('name'))
        return
    # set media transceiver using media Id and channel ID
    #
    for hwport in hwport_list:
        fp_details = fp.find_port_by_hwport(npu, hwport)
        if fp_details.port_group_id is None:
            _lane = fp_details.lane
        else:
            pg_list = fp.get_port_group_list()
            pg_obj = pg_list[fp_details.port_group_id]
            if ((pg_obj.get_profile_type()) == "ethernet_ddqsfp28"):
                _lane = pg_obj.get_lane(hwport)
            else:
                _lane = fp_details.lane
        media.media_transceiver_set(1, fp_details.media_id, _lane, enable)
def set_media_transceiver(interface_obj):
    # get front panel port from ifindex
    if_obj = cps_object.CPSObject(obj=interface_obj)
    npu = if_obj.get_attr_data('base-if-phy/if/interfaces/interface/npu-id')
    port = if_obj.get_attr_data('base-if-phy/if/interfaces/interface/port-id')
    print "set_media_transceiver for %d %d " %(npu, port)
    enable = if_obj.get_attr_data('if/interfaces/interface/enabled')
    port_list = nas_if.nas_os_phy_list(
        d={'npu-id': npu, 'port-id': port})
    phy_obj = cps_object.CPSObject(obj=port_list[0])
    fanout = phy_obj.get_attr_data('fanout-mode')
    try:
        hwport = phy_obj.get_attr_data('hardware-port-id')
        fp_details = fp.find_port_by_hwport(npu, hwport)
    except:
        print " Error in setting media Transceiver for ", if_obj.get_attr_data('name')
        return
    # set media transceiver using media Id and channel ID
    # in case of 40G mode all channels should be enabled/disabled
    #  else only one channel.
    #
    print "fanout " + str(fanout)
    if fanout == 2:  # then it is in 4x10G fanout mode BASE_PORT_BREAKOUT_MODE_BREAKOUT_4X1
        _lane = fp_details.lane
    else:    # non-fanout mode 1x40g mode
        _lane = None # enable/disable all channels. Do not pass Lane #
    media.media_transceiver_set(1, fp_details.media_id, _lane, enable)
Esempio n. 4
0
def set_intf_request(pas_media_obj):
    try:
        media_id = pas_media_obj.get_attr_data('port')
        display_str = pas_media_obj.get_attr_data(
            'base-pas/media/display-string')
    except:
        nas_if.log_info("Media String is not present in the media event")
        return

    # fetch FP info from media ID
    o = cps_object.CPSObject(
        module='base-if-phy/front-panel-port',
        data={'base-if-phy/front-panel-port/media-id': media_id})
    l = []
    fp_utils.gen_fp_port_list(o, l)
    if len(l) == 0:
        nas_if.log_err("No such port found... for media  " + str(media_id))
        return

    #fetching 2 front panel port object from 1 phy media id for QSFP28-DD ports
    port_list = []
    for fp_obj in l:
        obj = cps_object.CPSObject(obj=fp_obj)
        if nas_comm.yang.get_value('fp_key', 'keys_id') == obj.get_key():
            port_list = port_list + nas_if.physical_ports_for_front_panel_port(
                obj)

    if len(port_list) == 0:
        nas_if.log_err("There are no physical ports for front panel port ")
        nas_if.log_err(str(l[0]))
        return

    # create interface set RPC obj for each phy port in the list and send it
    for p in port_list:
        npu = p.get_attr_data('npu-id')
        port = p.get_attr_data('port-id')
        process_media_event(npu, port, pas_media_obj)
        hwport_list = p.get_attr_data('hardware-port-list')

        nas_if.log_info("send if obj for media id set for phy port " +
                        str(port))
        ifobj = cps_object.CPSObject(
            module='dell-base-if-cmn/if/interfaces/interface',
            data={
                'base-if-phy/if/interfaces/interface/npu-id': npu,
                'base-if-phy/if/interfaces/interface/port-id': port,
                'if/interfaces/interface/type': "ianaift:ethernetCsmacd"
            })
        if if_lib.set_media_setting(None, ifobj) == False:
            return
        ch = {'operation': 'set', 'change': ifobj.get()}
        cps.transaction([ch])
        if_name = if_config.if_config_get_by_npu_port(npu, port)
        if_details = nas_if.nas_os_if_list(
            d={'if/interfaces/interface/name': if_name})
        enable = ba.from_ba(
            if_details[0]['data']['if/interfaces/interface/enabled'],
            "uint64_t")
        for hwport in hwport_list:
            fp_details = fp.find_port_by_hwport(npu, hwport)
            if fp_details.port_group_id is None:
                _lane = fp_details.lane
            else:
                pg_list = fp.get_port_group_list()
                pg_obj = pg_list[fp_details.port_group_id]
                if ((pg_obj.get_profile_type()) == "ethernet_ddqsfp28"):
                    _lane = pg_obj.get_lane(hwport)
                else:
                    _lane = fp_details.lane
            media.media_transceiver_set(1, fp_details.media_id, _lane, enable)