package me.construqt.ciscian.chatter.flavour;

import me.construqt.ciscian.chatter.steps.flavoured.AnswerYes;
import me.construqt.ciscian.chatter.steps.flavoured.CiscoCopy;
import me.construqt.ciscian.chatter.steps.flavoured.Enable;
import me.construqt.ciscian.chatter.steps.flavoured.EnterInput;
import me.construqt.ciscian.chatter.steps.flavoured.Exit;
import me.construqt.ciscian.chatter.steps.flavoured.PasswordPrompt;
import me.construqt.ciscian.chatter.steps.flavoured.ShowRunningConfig;
import me.construqt.ciscian.chatter.steps.flavoured.WaitForPrompt;
import me.construqt.ciscian.chatter.steps.generic.Case;
import me.construqt.ciscian.chatter.steps.generic.CollectOutputStep;
import me.construqt.ciscian.chatter.steps.generic.Step;
import me.construqt.ciscian.chatter.steps.generic.SwitchStep;
import me.construqt.ciscian.chatter.steps.generic.WaitForStep;

public class DlinkDgs15xxSwitchChatter extends GenericCiscoFlavourSwitchChatter {

	@Override
	protected void enterManagementMode(final String username, final String password) {
	    getOutputConsumer().addStep(new SwitchStep(
		    new Case(">") {

			@Override
			public Step[] then() {
			    return new Step[] {};
			}
		    }, new Case("Username:") {

			@Override
			public Step[] then() {
			    return new Step[] {
				    new EnterInput(username),
				    new PasswordPrompt(),
				    new EnterInput(password) };
			}
		    }, new Case("Password:") {

			@Override
			public Step[] then() {
			    return new Step[] { new EnterInput(password) };
			}
		    }));
	    getOutputConsumer().addStep(new WaitForPrompt());
	}

	public void retrieveConfig() {
		getOutputConsumer().addStep(new ShowRunningConfig());
		getOutputConsumer().addStep(new WaitForStep("Current configuration :"));
		getOutputConsumer().addStep(new WaitForStep("\n\r"));
		getOutputConsumer().addStep(new WaitForStep("\n\r"));
		getOutputConsumer().addStep(
				new CollectOutputStep(false, "End of configuration file", "#",
						"\n\r", "\n\r"));
	}

	public void exit() {
		getOutputConsumer().addStep(new Exit());
	}

	@Override
	protected void saveRunningConfig() {
		getOutputConsumer().addStep(new CiscoCopy());
		getOutputConsumer().addStep(new AnswerYes());
	}

}

@@ -1040,20 +1040,17 @@
 ord) %7B%0A%09
-    
+%09
 getOutpu
@@ -1087,20 +1087,17 @@
 Step(%0A%09%09
-    
+%09
 new Case
@@ -1100,25 +1100,30 @@
 Case(%22%3E%22) %7B%0A
-%0A
+%09%09%09%09%0A%09
 %09%09%09@Override
@@ -1115,32 +1115,33 @@
 %09%0A%09%09%09%09@Override%0A
+%09
 %09%09%09public Step%5B%5D
@@ -1145,36 +1145,33 @@
 p%5B%5D then() %7B%0A%09%09%09
+%09
-    
 return new Step%5B
@@ -1176,27 +1176,25 @@
 p%5B%5D %7B%7D;%0A
+%09
 %09%09%09%7D%0A%09%09
-    
+%09
 %7D, new C
@@ -1208,25 +1208,30 @@
 ername:%22) %7B%0A
-%0A
+%09%09%09%09%0A%09
 %09%09%09@Override
@@ -1223,32 +1223,33 @@
 %09%0A%09%09%09%09@Override%0A
+%09
 %09%09%09public Step%5B%5D
@@ -1253,36 +1253,34 @@
 p%5B%5D then() %7B%0A%09%09%09
-    
+%09%09
 return new Step%5B
@@ -1283,28 +1283,26 @@
 tep%5B%5D %7B%0A%09%09%09%09
-    
+%09%09
 new EnterInp
@@ -1315,28 +1315,26 @@
 rname),%0A%09%09%09%09
-    
+%09%09
 new Password
@@ -1347,20 +1347,18 @@
 (),%0A%09%09%09%09
-    
+%09%09
 new Ente
@@ -1380,24 +1380,22 @@
 ) %7D;%0A%09%09%09
+%09
 %7D%0A%09%09
-    
+%09
 %7D, new C
@@ -1413,17 +1413,22 @@
 rd:%22) %7B%0A
-%0A
+%09%09%09%09%0A%09
 %09%09%09@Over
@@ -1432,16 +1432,17 @@
 verride%0A
+%09
 %09%09%09publi
@@ -1462,20 +1462,18 @@
 () %7B%0A%09%09%09
-    
+%09%09
 return n
@@ -1519,26 +1519,20 @@
 %0A%09%09%09
+%09
 %7D%0A%09%09
-    
 %7D));%0A%09
-    
+%09
 getO

Update DlinkDgs15xxSwitchChatter.java