Example #1
0
def link_asn_equipment(asn_id, equip_id):
    log.info("link_asn_equipment")

    from networkapi.api_asn.models import AsnEquipment

    asn_equipment = AsnEquipment()
    asn_equipment.create_v4(dict(equipment=equip_id, asn=asn_id))
Example #2
0
def link_asn_equipment(asn_id, equip_id):
    log.info("link_asn_equipment")

    from networkapi.api_asn.models import AsnEquipment

    asn_equipment = AsnEquipment()
    asn_equipment.create_v4(dict(equipment=equip_id, asn=asn_id))
Example #3
0
def create_asn_equipment(asn_equipment):
    """Create ASNEquipment."""

    try:
        asn_equipment_list = list()

        for equipment in asn_equipment.get("equipment"):
            obj = dict()
            obj["equipment"] = equipment
            obj["asn"] = asn_equipment.get("asn")
            as_obj = AsnEquipment()
            as_obj.create_v4(obj)
            asn_equipment_list.append({'id': as_obj.id})

    except AsnErrorV4 as e:
        raise ValidationAPIException(str(e))
    except ValidationAPIException as e:
        raise ValidationAPIException(str(e))
    except Exception as e:
        raise NetworkAPIException(str(e))

    return asn_equipment_list