cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
800
Views
0
Helpful
2
Replies

Create or Modify StaticPort request API to NDO using Postman

rtmtoky
Level 1
Level 1

Hello to everyone,

I would like to add a StaticPort and add also the domain association for an EPG. But unfortunately when I send the request it returns the "status 204 No Content" and I don't see any changes on Nexus Dashboard Orchestrator.

Request:

PATCH https://{{ndo_host}}/mso/api/v1/schemas/{{schema_id}}

Body:

[
    {
        "op": "add",
        "path": "/templates/{{templateName}}/anps/{{appName}}/epgs/{{epgName}}/domainAssociations",
        "value": {
                "dn": "uni/phys-TEST_PHD",
                "domainType": "physicalDomain",
                "deployImmediacy": "immediate",
                "resolutionImmediacy": "immediate",
                "allowMicroSegmentation": false,
                "numPorts": 0
        }
    },
    {
        "op": "add",
        "path": "/templates/{{templateName}}/anps/{{appName}}/epgs/{{epgName}}/staticPorts",
        "value": {
            "deploymentImmediacy": "immediate",
            "mode": "untagged",
            "path": "topology/pod-1/paths-101/pathep-[eth1/1]",
            "portEncapVlan": {{vlan}},
            "type": "port"
            }
    }
]

Something is missing in my code?  I'm using the following NDO:

Nexus Dashboard

Version 3.0.1i

Installed Services
OrchestratorVersion 4.2.3e

Any help would be appreciated, and thank you in advance for your time.

Regards,

T.

2 Replies 2

mfr-6
Spotlight
Spotlight

hi @rtmtoky 

Have you tried to exclude problems with variables you pass into a request? Could you try to build a request with hardcoded values to see if the issue is still present?

I found a quote from the changelog of the release you use saying:
"If you upgrade to this release from a release prior to 4.0(1), existing schemas’ IDs may change. If you are using any API automation that relies on static Schema IDs, we recommend dynamically obtaining the IDs before executing any action against the Schemas."
Just want to be sure you are not affected by this.
Ref: https://www.cisco.com/c/en/us/td/docs/dcn/ndo/4x/release-notes/cisco-nexus-dashboard-orchestrator-release-notes-423.html

Also please split this request into two different ones - one for a static port and another for domain association to see if this will work.

Mateusz Frak NetDevOps | DevNet | Automation
Please mark this post as helpful if it solves your issue, to make this visible for other users, thank you!

Hello @mfr-6,

thank you for your answer, I have already hardcoded before using variables into request.

For your information, I grabbed the schema IDs using the following methods:

1) I run this request "https://{{ndo_host}}/mso/api/v1/schemas" and see in the output if my EPG is under which schema:

...

{
   "anpRef": "/schemas/65f7fe94691d76b3f3c52db6/templates/AUTONOMOUS_1/anps/TEST_APP",
   "epgs": [
     {
       "epgRef": "/schemas/65f7fe94691d76b3f3c52db6/templates/AUTONOMOUS_1/anps/TEST_APP/epgs/101_TEST_EPG",
       "domainAssociations": [],
       "staticPorts": [],
       "staticLeafs": [],
       "uSegAttrs": [],
       "subnets": [],
       "selectors": [],
       "shutdown": false
     }
   ]
}

...

2) by browsing with NDO, I think the schema ID is part of the URL, right?

https://{{ndo_host}}/mso/configure/tenantTemplates/application/edit/65f7fe94691d76b3f3c52db6/AUTONOMOUS_1

I tried to split into 2 requests and hardcode as you suggested but for each request, it always returns "204 No Content"

Request1:

PATCH https://{{ndo_host}}/mso/api/v1/schemas/65f7fe94691d76b3f3c52db6

Body:

[
    {
        "op": "add",
        "path": "/templates/AUTONOMOUS_1/anps/TEST_APP/epgs/101_TEST_EPG/domainAssociations",
        "value": {
                "dn": "uni/phys-TEST_PHD",
                "domainType": "physicalDomain",
                "deployImmediacy": "immediate",
                "resolutionImmediacy": "immediate",
                "allowMicroSegmentation": false,
                "numPorts": 0
        }
    }
]
 

Request2:

PATCH https://{{ndo_host}}/mso/api/v1/schemas/65f7fe94691d76b3f3c52db6

Body:

[
    {
        "op": "add",
        "path": "/templates/AUTONOMOUS_1/anps/TEST_APP/epgs/101_TEST_EPG/staticPorts",
        "value": {
            "deploymentImmediacy": "immediate",
            "mode": "untagged",
            "path": "topology/pod-1/paths-101/pathep-[eth1/1]",
            "portEncapVlan": 101,
            "type": "port"
            }
    }
]

PS: I change with another existing schema ID but the request returns "400 Bad Request". By using the "correct" schema ID (provided by the 2 methods above), it returns "204 No Content".

I remain at your disposal for any further information, many thanks for your time.

Regards,