Reply

Need help to push custom field through python easy library

Member
Posts: 2
455     0

Hello Team,

 

I want to update custom fields in the network object.

In my case it is a switch (For testing purpose I am doing it on 1 device at the moment. I want to update custom fields there.

I have logged into the netmri through client broker and fetched out 2 fields:

1. z: Importing custom fields of the device (I imported of all the devices through remotesiteindex)

eg: {'45958789555447745599': ['10.11.10.10', 'region', 'role', 'devicetime']}

Siteid: [Device_ip, region_name, Role of the device, device_type]

 

2. y: Site ID where particular custom field is missing

y: {'siteID': [], 'networkAccessControl': [], 'businessUse': [], 'region':['45958789555447745599'], 'networkRole':  ['45958789555447745599']

 

As you can see I need to update region and networkRole custom_fields on device whose site ID is: 45958789555447745599

Other custom fields are blank because those fields are already defined in netmri.

 

Now, I am stuck on how to login into NETMRI to push custom values (region and networkRole) present in Z for above site ID.

 

I tried below URL to get an idea but no luck..!!!

https://github.com/infobloxopen/infoblox-netmri/blob/master/examples/tutorial/tutorial_7_create_cust...

 

Can someone please help me like If I can push through easy library. If yes then how to use easy library. I mean what would be the values comes in to login into device:

defaults = {
"api_url": 'api_url', <----what would be these values
"http_username": 'http_username',
"http_password": 'http_password',
"job_id": 'job_id',
"device_id": 'device_id',
"batch_id": 'batch_id'
}

 

And then how to reach till device_broker then can below script help me to push:

device_broker = easy.client.get_broker('Device')   <--- If I get the login, I don't know how to get this login and then would below code help me to update custom fields?

params = { "SiteID": site, "region": region }
result = csBroker.update(**params)
print(result)

 

Requesting here to please help me in this.

Re: Need help to push custom field through python easy library

Member
Posts: 2
455     0

Also what would be the parameters values

# variables will be provided by NetMRI
NetMRIEasy(**params)
easy = NetMRIEasy(**params)
host - api host. Provided by NetMRI
username - host username. Provided by NetMRI
password - host password. Provided by NetMRI
job_id - Job id. Provided by NetMRI
bacth_id - bacth id. Provided by NetMRI
device_id - device id. Provided by NetMRI
script_login - Defined by the Script-Login in the Script header section

 

So what would be the above variable values (If someone can give the example please) and once that is resolved then we can think of updating the custom field.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You