def configOspfv3(self, obj=None, routerId=None, port=None, portName=None, ngpfEndpointName=None, hostIp=None, **kwargs): """ Description Create or modify OSPFv3. If creating a new OSPFv3, provide an IPv6 object handle. If modifying a OSPF, there are five options. 2-6 will query for the OSPFv3 object handle. 1> Provide the OSPFv3 object handle using the obj parameter. 2> Set routerId. 3> Set port: The physical port. 4> Set portName: The vport port name. 5> Set NGPF OSPF name that you configured. 6> Set hostIp: The src IP. Parameters IPv6 object handle example: obj: /api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv6/1 OSPF object handle example: obj: /api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv6/1/ospfv3/1 routerId: : The router ID IP address. port: : Format: [ixChassisIp, str(cardNumber), str(portNumber)] portName: : The virtual port name. ngpfEndpointName: : The name that you configured for the NGPF endpoint. hostIp: : The source IP address to query for the object. kwargs: OSPF configuration attributes. The attributes could be obtained from the IxNetwork API browser. Syntax POST: /api/v1/sessions/{id}/ixnetwork/topology/{id}/deviceGroup/{id}/ethernet/{id}/ipv6/{id}/ospfv3 PATCH: /api/v1/sessions/{id}/ixnetwork/topology/{id}/deviceGroup/{id}/ethernet/{id}/ipv6/{id}/ospfv3/{id} Example: ospfObj1 = configOspf(ipv6Obj, name = 'ospf_1', areaId = '0', neighborIp = '::2', helloInterval = '10', areaIdIp = '::0', networkType = 'pointtomultipoint', deadInterval = '40') Return /api/v1/sessions/{id}/ixnetwork/topology/{id}/deviceGroup/{id}/ethernet/{id}/ipv6/{id}/ospfv3/{id} """ # To create new OSPFV3 object if obj != None: if 'ospf' not in obj: ospfUrl = self.ixnObj.httpHeader+obj+'/ospfv3' self.ixnObj.logInfo('Create new OSPFv3 in NGPF') response = self.ixnObj.post(ospfUrl) # /api/v1/sessions/1/ixnetwork/topology/1/deviceGroup/1/ethernet/1/ipv6/1/ospfv3/1 ospfObj = response.json()['links'][0]['href'] # To modify OSPF if 'ospf' in obj: ospfObj = obj # To modify if ngpfEndpointName: ospfObj = self.getNgpfObjectHandleByName(ngpfEndpointName=ngpfEndpointName, ngpfEndpointObject='ospfv3') # To modify if port: x = self.getProtocolListByPortNgpf(port=port) ospfObj = self.getProtocolObjFromProtocolList(x['deviceGroup'], 'ospfv3')[0] # To modify if portName: x = self.getProtocolListByPortNgpf(portName=portName) ospfObj = self.getProtocolObjFromProtocolList(x['deviceGroup'], 'ospfv3')[0] # To modify if routerId: ospfObj = self.getNgpfObjectHandleByRouterId(routerId=routerId, ngpfEndpointObject='ospfv3') # To modify if hostIp: x = self.getProtocolListByHostIpNgpf(hostIp) ospfObj = self.getProtocolObjFromHostIp(x, protocol='ospfv3') ospfObjResponse = self.ixnObj.get(self.ixnObj.httpHeader+ospfObj) if 'name' in kwargs: self.ixnObj.patch(self.ixnObj.httpHeader+ospfObj, data={'name': kwargs['name']}) for key,value in ospfObjResponse.json().items(): if key != 'links': if bool(re.search('multivalue', str(value))) == True: if key in kwargs: multiValue = ospfObjResponse.json()[key] self.ixnObj.logInfo('Configuring OSPF multivalue attribute: %s' % key) self.ixnObj.patch(self.ixnObj.httpHeader+multiValue+"/singleValue", data={'value': kwargs[key]}) else: if key in kwargs: self.ixnObj.patch(self.ixnObj.httpHeader+ospfObj, data={key: kwargs[key]}) ospfv3AttributeList = ['lsaRefreshTime', 'lsaRetransmitTime', 'interFloodLsUpdateBurstGap'] if (any(attribute in ospfv3AttributeList for attribute in kwargs)): ospfRouterUrl = self.ixnObj.httpHeader + ospfObj.split('ethernet')[0] + 'ospfv3Router' ospfRouterObjResponse = self.ixnObj.get( ospfRouterUrl + '/' + str(self.ixnObj.get(ospfRouterUrl).json()[0]['id'])) for key, value in ospfRouterObjResponse.json().items(): if key != 'links': if bool(re.search('multivalue', str(value))) == True: if key in kwargs: multiValue = ospfRouterObjResponse.json()[key] self.ixnObj.logInfo('Configuring OSPF Router multivalue attribute: %s' % key) self.configMultivalue(multiValue, 'singleValue', data={'value': kwargs[key]}) else: if key in kwargs: self.ixnObj.patch(self.ixnObj.httpHeader + ospfRouterObjResponse, data={key: kwargs[key]}) self.configuredProtocols.append(ospfObj) return ospfObj