Software Defined Networking
cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble with Controller RESTful interface JSON statement

 
Highlighted
Occasional Advisor

Trouble with Controller RESTful interface JSON statement

Controller: Version 2.5.15

Switch: HP 5500EI 

 

I have been using the https://<controller-ip>:8443/sdn/v2.0/models to guide me here but I have to admit, I'm a little lost.

 

I have also searched high and low for a REST JSON example of doing something other than setting the output port but I havent found much other than a rate limiter. 

 

Using some java examples in here, Im just guessing that to set a new VLAN header for the packet I first need to make  "push_vlan" action, followed by a "set_field". I dont know how to contruct these message properly and I cannot really find my way through the JSON models guide. I can occasionally get a "201 - Created" response from the controller but the flow does not show up, leading me to believe the JSON was fine but the controller was not able to turn that into a ledgible/complete message for the switch to interpret. 

 

This is the current statement Im working with and it is based on a java example posted in here. This currently returns a "http 500" with many java errors in it. 

 

{
"flow": {
               "cookie": "0x20121687",
               "table_id": 0,
               "priority": 30000,
               "idle_timeout": 30,
               "hard_timeout": 45,
               "match": [
                               {"ipv4_src": "10.28.134.100"},
                               {"ipv4_dst": "8.8.8.8"},
                               {"eth_type": "ipv4"}
              ],
               "instructions": [{"apply_actions": [{"push_vlan": "VLAN"},
                                                                               {"set_field": [{"vlan_vid": 28}]}]}]
}
}

 

I understand when the action in the model is an int or string. but I get lost and start guessing when it does a #ref to another structure, hence why I "think" they are these nested types that I have in my example??

 

For instance, models shows for the "push_vlan" to use

 

  • push_vlan:
     
    {
    • description: "Push a new VLAN header onto the packet",
    • $ref: "#/ethernet_vlan"
    },

so when checking out the #/ethernet_vlan, i find:

 

  • ethernet_vlan:
     
    {
    • description: "Ethernet types for vlan-related action",
    • type: "string",
    • enum:
       
      [
      • "vlan",
      • "prv_brdg"
      ]
    },

I have a feeling Im going about this the totally wrong way. Please assist if possible! There isnt a whole lot of examples of REST JSON statements out there other than the very easy "output: 1" examples, which I have working fine. 

 

Thanks in advance!

 

3 REPLIES 3
Highlighted
Occasional Advisor

Re: Trouble with Controller RESTful interface JSON statement

I changed my instructions to the following and observed a "201 - CREATED" response but no flow entry was added to the switch. 

 

"instructions": [{"apply_actions": [{"push_mpls": "mpls_u"}]}]

 

message from controller to switch:

 

{ofm:[V_1_3,FLOW_MOD,96,6075],cmd=ADD,match={Match(V_1_3):[type=OXM,len=32],fields=ETH_TYPE,VLAN_VID,IPV4_SRC,IPV4_DST},...}
  Cookie   : 0x20121687
  C Mask   : 0x0
  Table ID : 0
  FMod Cmd : ADD
  Idle t/o : 30s
  Hard t/o : 45s
  Priority : 30000
  Buffer ID: 0xffffffff(NO_BUFFER)
  Out Port : 0xffffffff(ANY)
  Out Group: 0xffffffff(ANY)
  FMod Flgs: []
  Match    : {Match(V_1_3):[type=OXM,len=32],fields=ETH_TYPE,VLAN_VID,IPV4_SRC,IPV4_DST}
    {Oxm:V_1_3:[cls=0x8000(OPENFLOW_BASIC),ft=5(ETH_TYPE),hm=false,len=2],type=0x0800(IPv4)}
    {Oxm:V_1_3:[cls=0x8000(OPENFLOW_BASIC),ft=6(VLAN_VID),hm=false,len=2],vlan-id=2028}
    {Oxm:V_1_3:[cls=0x8000(OPENFLOW_BASIC),ft=11(IPV4_SRC),hm=false,len=4],ip=10.28.134.100}
    {Oxm:V_1_3:[cls=0x8000(OPENFLOW_BASIC),ft=12(IPV4_DST),hm=false,len=4],ip=8.8.8.8}
  Instructions:
    {Instr:V_1_3:[type=APPLY_ACTIONS,len=16],actList=PUSH_MPLS}
      {Act:[PUSH_MPLS,len=8],eth=0x8847(MPLS_U)}
 

 

and repsonse from the switch:

 

{ofm:[V_1_3,ERROR,76,6075],BAD_ACTION/BAD_TYPE,#dataBytes=64,OFM-cause:[V_1_3,FLOW_MOD,96,6075]}
  data = 040e0060000017bb000000002012168700000000000000000000001e002d7530ffffffffffffffffffffffff000000000001002080000a02080080000c0217ec
Highlighted
Occasional Advisor

Re: Trouble with Controller RESTful interface JSON statement

Another test after finding a gem in here about "how to use set_fields". I finally have my fields set correctly and again I am recieving a "201 - Created" message from the controller. 

 

My JSON actions statements are as follows:

 

"instructions": [{"apply_actions":[{"set_field":{"vlan_vid": 2028}},
{"output": 9437211}]}]

 

Now the controller is getting the following message from the switch:

 

Time: 17:54:06.367
Event: Rx
Data Path ID: 00:0a:bc:ea:fa:3e:bf:36
Message: {ofm:[V_1_3,ERROR,76,315618],FLOW_MOD_FAILED/UNKNOWN,#dataBytes=64,OFM-cause:[V_1_3,FLOW_MOD,120,315618]}

 

Im digging around for this error and looking for the openflow admin guide for the HP5500EI to see if setting the vlan_vid is even supported, so far I havent found much. 

Highlighted
Frequent Advisor

Re: Trouble with Controller RESTful interface JSON statement

Hi Dave,

 

Generally speaking; When you receive the 201 from the controller that means that the JSON statement was syntactically correct and it the flow mod was send to the switch. The switch then receives the the flow mod and evaluates whether it can be inserted in the indicated table. If for any reason, for example because of the capabilities of the underlying hardware or because some conditions are not met (for example the VLAN does not exist on switch), the switch will not insert the flow and send an error 76 back to the controller.

 

Without knowing your exact topology and versions and with out knowing exactly what you are trying to accomplish it is hard to give more definite answers, but the 5500 will not do any MPLS label related actions so you will get the 76 for that. Depending on the software version it might be able to set a VLAN ID, but I think the specific VLAN that is being set must be configured on the switch and. Let me know if this helps.

 

Best regards,

 

Wouter

HP SDN CoE Team