Software Defined Networking
1753758 Members
4852 Online
108799 Solutions
New Discussion

Adding Meters to datapaths

 
Pradeep_30
Esteemed Contributor

Adding Meters to datapaths

Hello Experts,

 

Following code for adding meter is giving me invalid jason error. Could anyone spare some time in identifying the root cause?

 

meter_band = hp.datatypes.MeterBand(mtype = "drop", rate=10000)
flags = ["kbps"]
bands = [meter_band]
meter = hp.datatypes.Meter(id = 1, command = "add", flags = flags, bands = bands)
api.add_meter(d.dpid, meter)

 

 

 

 

#********* Error

Traceback (most recent call last):
  File "rate_limit.py", line 44, in <module>
    api.add_meter(d.dpid, meter)
  File "C:\Python27\lib\site-packages\hpsdnclient\of.py", line 194, in add_meter
    r = self.restclient.post(url, json.dumps(meter.to_dict()))
  File "C:\Python27\lib\site-packages\hpsdnclient\rest.py", line 143, in post
    raise_errors(r)
  File "C:\Python27\lib\site-packages\hpsdnclient\error.py", line 27, in raise_errors
    raise_400(response)
  File "C:\Python27\lib\site-packages\hpsdnclient\error.py", line 43, in raise_400
    data['message'])
hpsdnclient.error.InvalidJson: Invalid JSON format: null.  Please refer to the HP VAN SDN Controller JSON

 

Thanks in advance

Pradeep

2 REPLIES 2
Pradeep_30
Esteemed Contributor

Re: Adding Meters to datapaths

Ok. Turned out to be the hp-sdn-client python code had a bug. HP R&D folks lend a helping hand in fixing it. It was nice. I was able to create the meter on physical openflow1.3 enabled switches. The code fails when tried with virtual

 

Does anyone have experience in working with openflow 1.3 meters on virtual environment( mininet-openvswitch)?

 

Thank you

Pradeep

sdnindia
Trusted Contributor

Re: Adding Meters to datapaths

Hello Pradeep,

 

You can use RESTAPI  POST /sdn/v2.0/of/datapaths/{dpid}/meters  [REST API Doc page 57] to create meter however if you are trying the same with some code[python] , please share the code/error/screen shot in case you are facing some problem.

 

Thanks,

HP SDN Team