Hi Anil,

The push vlan is working fine. It does not work when I have a push and a
goto instruction.

Either the push OR the goto shows up. I cannot have BOTH push and goto in
the same flow.

I am working via the java API. I am working with the Carbon-42 openflow
plugin.

Please see attached Java file.

I had planned to reproduce the issue using a stand alone test script using
the XML API.

Let me know if I should do that.

Thank you for your help.

Regards,

Ranga



On Fri, Dec 8, 2017 at 8:35 PM, Anil Vishnoi <[email protected]> wrote:

> can you please paste me the flow that you are writing to the datastore?
> Because i tried to push the PUSH_VLAN flow that you mentioned above and i
> was able to push the flow successfully and i see the same data in the
> config data store when i fetched it back.
>
> On Wed, Dec 6, 2017 at 8:27 AM, M. Ranganathan <[email protected]> wrote:
>
>>
>>
>> I logged everything that I send to the transaction. When I print out the
>> flow (which follows a yang model), I can see all the elements in there (see
>> my previous mail in this thread). It is possible that the openflow
>> southbound plugin which stuffs the datstore (?)  does not like something
>> and is silently stripping out data. Once the transaction is submitted and
>> commit succeeds, the app should be able to release references to the data.
>> Indeed I am making the whole commit synchronous to avoid shooting myself in
>> the foot.
>>
>> I will engage with the openflow plugin developers to see how I can track
>> this down. I hope somebody will respond from the openflowplugin-dev list to
>> let me know what debug I should turn on so I can produce some more
>> diagnostics.
>>
>> So in summary, I am able to reproduce the following action in a flow via
>> the JAVA API.
>>
>> https://wiki.opendaylight.org/view/Editing_OpenDaylight_Open
>> Flow_Plugin:End_to_End_Flows:Example_Flows#Push_VLAN
>>
>> I can mimic what the REST api does by direct JAVA calls and the flow does
>> appear but what I want is to ALSO have a goto. This is my issue. If the
>> GOTO is added to the flow, the VLAN push action is stripped off.
>>
>> Thanks for your tips and sorry for the number of mails on this.
>>
>>
>>
>>
>> On Wed, Dec 6, 2017 at 11:16 AM, Tom Pantelis <[email protected]>
>> wrote:
>>
>>>
>>>
>>> On Wed, Dec 6, 2017 at 10:46 AM, M. Ranganathan <[email protected]>
>>> wrote:
>>>
>>>> Hi Ryan,
>>>>
>>>> Thanks for forwarding but what is puzzling me is why the flow does not
>>>> appear as it should in the Config Datastore. If the YANG model matches
>>>> should it not appear in the config datastore?
>>>>
>>>> I could see it as an openflow problem if I saw an exception why trying
>>>> to instantiate the flow.
>>>>
>>>> I was suspecting MDSAL for this reason. Perhaps I am mistaken.
>>>>
>>>
>>> The MDSAL commits exactly what clients tell it to do, ie it doesn't
>>> randomly omit or strip out data. I'm not that familiar with OFP and I'm not
>>> really clear on exactly what you're doing but if something is missing in
>>> the data then I suspect either it isn't getting written or it was deleted
>>> or overwritten somewhere along the line in the app code.
>>>
>>>
>>>>
>>>> Thanks.
>>>>
>>>> Ranga
>>>>
>>>
>>>
>>
>>
>> --
>> M. Ranganathan
>>
>> “If debugging is the process of removing software bugs, then programming
>> must be the process of putting them in.” – Edsger Dijkstra
>>
>>
>> _______________________________________________
>> openflowplugin-dev mailing list
>> [email protected]
>> https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev
>>
>>
>
>
> --
> Thanks
> Anil
>



-- 
M. Ranganathan

“If debugging is the process of removing software bugs, then programming
must be the process of putting them in.” – Edsger Dijkstra
	private static Instruction createSetVlanAndOutputToPortInstructions(int vlanId, String outputPortUri) {

		List<Action> actionList = new ArrayList<>();
		ActionBuilder ab = new ActionBuilder();

		Integer VLAN_ETHERTYPE = 0x8100;
		ActionBuilder actionBuilder = new ActionBuilder();

		// push vlan
		Action pushVlanAction = actionBuilder.setOrder(0)
				.setAction(new PushVlanActionCaseBuilder()
						.setPushVlanAction(
								new PushVlanActionBuilder().setTag(vlanId).setEthernetType(VLAN_ETHERTYPE).build())
						.build())
				.build();
		actionList.add(pushVlanAction);

		// set vlan id
		Action setVlanIdAction = actionBuilder.setOrder(1)
				.setAction(
						new SetFieldCaseBuilder()
								.setSetField(new SetFieldBuilder()
										.setVlanMatch(new VlanMatchBuilder().setVlanId(new VlanIdBuilder()
												.setVlanId(new VlanId(vlanId)).setVlanIdPresent(true).build()).build())
										.build())
								.build())
				.build();

		actionList.add(setVlanIdAction);

		// Output to Port.
		OutputActionBuilder output = new OutputActionBuilder();
		output.setMaxLength(Integer.valueOf(0xffff));

		Uri controllerPort = new Uri(outputPortUri);
		output.setOutputNodeConnector(controllerPort);

		ab.setOrder(2);
		ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
		actionList.add(ab.build());

		ApplyActionsBuilder aab = new ApplyActionsBuilder();
		aab.setAction(actionList);

		InstructionBuilder ib = new InstructionBuilder();
		ib.setOrder(0);

		ib.setKey(new InstructionKey(0));
		ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());

		return ib.build();
	}

	public static FlowBuilder createMetadataMatchVlanTagSendToPort(FlowCookie flowCookie, FlowId flowId, Short tableId,
			String outputPortUri, int time) {

		MatchBuilder matchBuilder = new MatchBuilder();
		createMetadataMatch(matchBuilder, flowCookie.getValue());

		InstructionBuilder ib = new InstructionBuilder();
		Instruction createVlanTag = FlowUtils
				.createSetVlanAndOutputToPortInstructions(1001, outputPortUri);

		InstructionsBuilder insb = new InstructionsBuilder();

		ArrayList<Instruction> instructions = new ArrayList<Instruction>();
		instructions.add(createVlanTag);

		
	    Instruction gotoInstruction = ib.setOrder(3) .setInstruction(new
		                            GoToTableCaseBuilder() .setGoToTable(new
		                            GoToTableBuilder().setTableId(SdnMudConstants.STRIP_VLAN_RULE_TABLE).
		                            build()) .build()) .setKey(new InstructionKey(0)).build();
		                            instructions.add(gotoInstruction);
		

		insb.setInstruction(instructions);

		FlowBuilder fb = new FlowBuilder();
		fb.setStrict(false);
		fb.setBarrier(false);

		fb.setMatch(matchBuilder.build()).setTableId(tableId)
				.setFlowName("metadataMatchSetVLANTagSendToPortAndGoToStripVlanTagTable").setId(flowId)
				.setKey(new FlowKey(flowId)).setCookie(flowCookie).setInstructions(insb.build())
				.setPriority(SdnMudConstants.MATCHED_DROP_PACKET_FLOW_PRIORITY).setBufferId(OFConstants.ANY)
				.setHardTimeout(time).setIdleTimeout(0).setFlags(new FlowModFlags(false, false, false, false, false));

		return fb;

	}
_______________________________________________
openflowplugin-dev mailing list
[email protected]
https://lists.opendaylight.org/mailman/listinfo/openflowplugin-dev

Reply via email to