cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
786
Views
10
Helpful
4
Replies

Attach EPG to existing AEP with REST API

QuintH
Level 1
Level 1

Hi,

I am trying to attach an existing EPG to an existing AEP with the REST API.

This is the config I have:

"infraRsFuncToEpg":{
"attributes":{
"dn":"uni/infra/attentp-{{aep}}/gen-default/rsfuncToEpg-[uni/tn-{{tenant}}/ap-{{app_profile}}/{{epg}}]",
"encap":"vlan-{{vlan}}",
"instrImedcy":"lazy",
"mode":"regular",
"primaryEncap":"unknown",
"state":"formed",
"status":"",
"tDn":"uni/tn-{{tenant}}/ap-{{app_profile}}/{{epg}}",
}
}

I am getting the following error:

 "error": {
                "attributes": {
                    "code""120",
                    "text""unknown property value uni/infra/attentp-T_aep_ESX/gen-default/rsfuncToEpg-[uni/tn-LAN/ap-app_M/T_epg_Front-End], name dn, class infraRsFuncToEpg [(Dn0)] Dn0=, "

Any ideas?
Thank you in advance!

Quint

1 Accepted Solution

Accepted Solutions

QuintH
Level 1
Level 1

Hi,

Thanks to @RedNectar I found the solution.
I've added attribute to the infraGeneric. (See in red)

{
"totalCount": "1",
"imdata": [{
"infraAttEntityP": {
"attributes": {
"dn": "uni/infra/attentp-{{aep}}",
"name": "{{aep}}"
},
"children": [{
"infraGeneric": {
"attributes": {
"name": "default"

}
"children": [{
"infraRsFuncToEpg": {
"attributes": {
"encap": "vlan-{{vlan}}",
"instrImedcy": "lazy",
"mode": "regular",
"primaryEncap": "unknown",
"tDn": "uni/tn-{{tenant}}/ap-{{app_profile}}/epg-{{epg}}"
}
}
}]
}
}]
}
}]
}

View solution in original post

4 Replies 4

RedNectar
VIP
VIP

Hi @QuintH ,

You say you are using the REST API - but you JSON looks like it is full of variables, so you are not telling the WHOLE story - are you using Postman? Are you using Jinja? Are you you simply pushing the JSON using maybe a python script.

Try using the JSON below, in particular, note the letters epg- in the line  "tDn": "uni/tn-{{tenant}}/ap-{{app_profile}}/epg-{{epg}}"

{
  "totalCount": "1",
  "imdata": [{
    "infraAttEntityP": {
      "attributes": {
        "dn": "uni/infra/attentp-{{aep}}",
        "name": "{{aep}}"
      },
      "children": [{
        "infraGeneric": {
          "children": [{
            "infraRsFuncToEpg": {
              "attributes": {
                "encap": "vlan-{{vlan}}",
                "instrImedcy": "lazy",
                "mode": "regular",
                "primaryEncap": "unknown",
                "tDn": "uni/tn-{{tenant}}/ap-{{app_profile}}/epg-{{epg}}"
              }
            }
          }]
        }
      }]
    }
  }]
}

 

RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.

Hi @RedNectar !

Thank you for the quick answer!
Sorry that I did not mention it, but yes I am using Postman.
I tried your code but I get an error:

{
    "totalCount""1",
    "imdata": [
        {
            "error": {
                "attributes": {
                    "code""400",
                    "text""invalid data at line '11'. Attributes are missing, tag 'attributes' must be specified first, before any other tag"
                }
            }
        }
    ]
}
Kind Regards,
 
Quint

Hi @QuintH ,

Ahh - yes. I got a bit heavy on the trimming of my JSON. But glad to see you figured it out. 

 

RedNectar aka Chris Welsh.
Forum Tips: 1. Paste images inline - don't attach. 2. Always mark helpful and correct answers, it helps others find what they need.

QuintH
Level 1
Level 1

Hi,

Thanks to @RedNectar I found the solution.
I've added attribute to the infraGeneric. (See in red)

{
"totalCount": "1",
"imdata": [{
"infraAttEntityP": {
"attributes": {
"dn": "uni/infra/attentp-{{aep}}",
"name": "{{aep}}"
},
"children": [{
"infraGeneric": {
"attributes": {
"name": "default"

}
"children": [{
"infraRsFuncToEpg": {
"attributes": {
"encap": "vlan-{{vlan}}",
"instrImedcy": "lazy",
"mode": "regular",
"primaryEncap": "unknown",
"tDn": "uni/tn-{{tenant}}/ap-{{app_profile}}/epg-{{epg}}"
}
}
}]
}
}]
}
}]
}

Review Cisco Networking for a $25 gift card

Save 25% on Day-2 Operations Add-On License