def test_netbox26_properties_interface_lag_trunk():

    config.load_config()
    data = yaml.safe_load(open(f"{HERE}/{FIXTURES}/interface_lag_trunk.json"))
    rem = pynetbox.models.dcim.Interfaces(data, "http://mock", 1)

    intf = Netbox27Interface()
    intf.add(rem)

    intf_prop = Netbox27Interface.get_properties(intf)

    assert intf_prop["mode"] == "tagged"
def test_netbox27_properties_long_description():

    config.load_config()
    data = yaml.safe_load(open(f"{HERE}/{FIXTURES}/interface_physical.json"))
    rem = pynetbox.models.dcim.Interfaces(data, "http://mock", 1)

    intf = Netbox27Interface()
    intf.add(rem)

    intf_prop = Netbox27Interface.get_properties(intf)

    assert len(intf_prop["description"]) == 100
def test_netbox26_properties_interface_loopback():

    config.load_config()
    data = yaml.safe_load(open(f"{HERE}/{FIXTURES}/interface_loopback.json"))
    rem = pynetbox.models.dcim.Interfaces(data, "http://mock", 1)

    intf = Netbox27Interface()
    intf.add(rem)

    intf_prop = Netbox27Interface.get_properties(intf)

    assert intf_prop["type"] == "virtual"
    assert "mode" not in intf_prop.keys()
    assert intf_prop["enabled"] == True
def test_netbox27_add_interface_no_type():

    config.load_config()
    data = yaml.safe_load(open(f"{HERE}/{FIXTURES}/interface_no_type.json"))
    rem = pynetbox.models.dcim.Interfaces(data, "http://mock", 1)

    intf = Netbox27Interface()
    intf.add(rem)

    assert intf.is_lag == False
    assert intf.is_virtual == False
    assert intf.is_lag_member == None
    assert intf.switchport_mode == "ACCESS"
    assert intf.access_vlan == 300
def test_netbox27_add_interface_lag_trunk():

    config.load_config()
    data = yaml.safe_load(open(f"{HERE}/{FIXTURES}/interface_lag_trunk.json"))
    rem = pynetbox.models.dcim.Interfaces(data, "http://mock", 1)

    intf = Netbox27Interface()
    intf.add(rem)

    assert intf.is_lag == True
    assert intf.is_virtual == False
    assert intf.is_lag_member == None
    assert intf.switchport_mode == "TRUNK"
    assert intf.access_vlan == 300
    assert intf.allowed_vlans == [300, 301]