Esempio n. 1
0
def test_discover_brocade_optical(params, expect_service):
    section: brocade_optical.Section = {
        '1410': {
            'description': '10GigabitEthernet23/2',
            'operational_status': '1',
            'part': '57-0000076-01',
            'port_type': '6',
            'rx_light': (-36.9897, 'Low-Alarm'),
            'serial': 'ADF2094300014UN',
            'temp': (31.4882, 'Normal'),
            'tx_light': (-1.4508, 'Normal'),
            'type': '10GE LR 10km SFP+'
        }
    }
    services = [Service(item='1410', parameters={}, labels=[])]
    assert list(brocade_optical.discover_brocade_optical(
        params,
        section,
    )) == (expect_service and services or [])
def test_discover_brocade_optical(params, expect_service):
    section: brocade_optical.Section = {
        "1410": {
            "description": "10GigabitEthernet23/2",
            "operational_status": "1",
            "part": "57-0000076-01",
            "port_type": "6",
            "rx_light": (-36.9897, "Low-Alarm"),
            "serial": "ADF2094300014UN",
            "temp": (31.4882, "Normal"),
            "tx_light": (-1.4508, "Normal"),
            "type": "10GE LR 10km SFP+",
        }
    }
    services = [Service(item="1410", parameters={}, labels=[])]
    assert (list(brocade_optical.discover_brocade_optical(
        params,
        section,
    )) == (expect_service and services or []))
Esempio n. 3
0
def test_regression(
    string_table,
    discovery_results,
    items_params_results,
):
    section = brocade_optical.parse_brocade_optical(string_table)

    assert list(
        brocade_optical.discover_brocade_optical(
            [(interfaces.DISCOVERY_DEFAULT_PARAMETERS)],
            section,
        )) == discovery_results

    for item, par, res in items_params_results:
        assert list(brocade_optical.check_brocade_optical(
            item,
            (par),
            section,
        )) == res