cancel
Showing results for 
Search instead for 
Did you mean: 
cancel

Who Me Too'd this topic

Subinterfaces on a device in subdomains

sullinsms
Level 1
Level 1

I am trying to configure sub interfaces on a device located in a subdomains . I am unable to make this work. When I use the API-explore I receive the error below. I have also tried using python code below.

Devices:

  • FMC virtual 6.6.1
  • FTD virtual 6.6.1

 

API-Explorer error

{

  "error": {

    "category": "FRAMEWORK",

    "messages": [

      {

        "description": "You do not have the required authorization to do this operation."

      }

    ],

    "severity": "ERROR"

  }

}

 

 

API-Explorer code

{

        "type": "SubInterface",

        "vlanId": 30,

        "subIntfId": 12345,

        "enabled": true,

        "MTU": 1500,

        "managementOnly": false,

        "enableAntiSpoofing": true,

        "enableSGTPropagate": true,

        "ifname": "Intf_name",

        "name": "GigabitEthernet0/1",

        "overrideDefaultFragmentSetting": {

            "size": 200,

            "chain": 24,

            "timeout": 5

        },

        

        "ipv4": {

            "static": {

                "address": "1.2.3.4",

                "netmask": "25"

            }

        }

    }

 

sullinsms_0-1624735514001.png

 

 

sullinsms_1-1624735514016.png

 

 

 

 

 

 

 

 

Python Code error

 

 

Response test {"error":{"category":"FRAMEWORK","messages":[{"description":"Invalid Request"}],"severity":"ERROR"}}

Response

<Response [404]>

Python Code

 

def configure_subinterface(addr: str = None, token: str = None):

 

    print("*" * 80)

    print("Create subinterfaces")

       

    db_list0 = {}

    db_list1 = {}

   

    with os.scandir('./') as entries:

     for entry in entries:

      db_list0[entry.name] = entry.name

 

    print("*" * 80)

    ftdinterface = selectFromDict(db_list0, 'FTD interface backup to restore')

   

    with open(ftdinterface) as readfile:

      subinterface = json.load(readfile)

   

    with os.scandir('./') as entries:

     for entry in entries:

      db_list1[entry.name] = entry.name

 

    print("*" * 80)

    ftdrecord = selectFromDict(db_list1, 'FTD device to apply interface')

    print("*" * 80) 

   

    with open(ftdrecord) as readfile:

      devicerecord = json.load(readfile)

 

    domainuuid = ("e276abec-e0f2-11e3-8169-6d9ed49b625f/ " + devicerecord['items'][0]['metadata']['domain']['id'])

    deviceuuid = devicerecord['items'][0]['id']

   

   

    payload = json.dumps([

        {

            "type": "SubInterface",

            "vlanId": 30,

            "subIntfId": 12345,

            "enabled": True,

            "MTU": 1500,

            "managementOnly": True,

            "enableAntiSpoofing": True,

            "enableSGTPropagate": True,

            "ifname": "Intf_name",

            "name": "GigabitEthernet0/1",

            "overrideDefaultFragmentSetting": {

            "size": 200,

            "chain": 24,

            "timeout": 5

            },

            "securityZone": {

            "id": "a5d02a5e-d1ce-11eb-9144-f657a2d3df95",

            "type": "SecurityZone"

            },

            "ipv4": {

            "static": {

                "address": "1.2.3.4",

                "netmask": "25"

            }

            }

        }

        ])

      

 

    api_uri = f"/api/fmc_config/v1/domain/e276abec-e0f2-11e3-8169-6d9ed49b625f/ 7f180e2c-ce4a-489f-57df-000000000001/devices/devicerecords/{deviceuuid}/subinterfaces?bulk=true"

    url = "https://" + addr + api_uri

    headers = { "X-auth-access-token": token } 

 

    response = requests.request("POST", url, headers=headers, data=json.dumps(payload), verify=False)

Who Me Too'd this topic