I want to add a simple flow which match the input port and output the packet on the other port.
I wrote this flow
<flow xmlns="urn:opendaylight:flow:inventory"> <strict>false</strict> <instructions> <instruction> <apply-actions> <action> <output-node-connector>1</output-node-connector> </action> </apply-actions> </instruction> </instructions> <match> <in-port>0</in-port> </match> <flow-name>flow</flow-name> </flow>
but I get this error bash: syntax error near unexpected token `<
this is how i write the command in terminal
curl -u admin:admin -H 'Content-Type:application/xml' -X PUT -d <flow xmlns="urn:opendaylight:flow:inventory"> <strict>false</strict> <instructions> <instruction> <apply-actions> <action> <output-node-connector>1</output-node-connector> </action> </apply-actions> </instruction> </instructions> <match> <in-port>0</in-port> </match> <flow-name>'flow'</flow-name> </flow> 'http://192.168.19.132:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:2/table/0/flow/1'
any help would be appreciated.
Related
I need to replace mutliple lines in .wsdd file in war generated after my maven build.
I am using antrun-maven-plugin and ant's replace task for this purpose.
Below is the snippet from pom.xml:
<plugin>
<groupId>com.github.odavid.maven.plugins</groupId>
<artifactId>antrun-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<ant antfile="replace.xml">
<target name="replace-config"/>
</ant>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions></plugin>
Here the replace.xml contains ant target to actually replace the multiline token and updating final war with replaced .wsdd file, below is part where we replace the multiline token in .wsdd file.
<target name ="replace-config">
<echo>********** Replacing tokens in server-config.wsdd file *************</echo>
<replace dir="${basedir}/target/as_gen/WEB-INF/" >
<include name="server-config.wsdd"/>
<replacetoken><![CDATA[<requestFlow>
<handler type="java:org.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="session"/>
</handler>
<handler type="java:org.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="request"/>
<parameter name="extension" value=".jwr"/>
</handler>
</requestFlow>]]></replacetoken>
<replacevalue><![CDATA[<requestFlow>
<handler type="java:com.as.webservices.TS9TicketTokenSender">
<parameter name="scope" value="session"/>
</handler>
<handler name="_wss4j_as_receiver_handler" type="java:com.as.security.asWSSReceiverHandler">
<parameter name="action" value="NoSecurity"/>
</handler>
<handler type="java:com.cm.ChangeHandler"/>
<handler type="java:com.cm.WSLoggingHandler"/>
</requestFlow>
<responseFlow>
<handler type="java:com.as.webservices.TS9TicketTokenSender"/>
<handler name="_wss4j_as_sender_handler" type="java:com.as.security.asWSSSenderHandler">
<parameter name="signatureKeyIdentifier" value="IssuerSerial"/>
<parameter name="encryptionKeyIdentifier" value="IssuerSerial"/>
<parameter name="action" value="NoSecurity"/>
</handler>
<handler type="java:com.cm.WSLoggingHandler"/>
</responseFlow>
]]></replacevalue>
</replace>
Now this gives correct results when run on unix machine, and token is successfully replaced by replace value but somehow the replacement does not take place on my windows machine.
Kindly help with issue identification and alternate method to do so. Thanks.
I was able to do this using ant's replaceregexp task.
identified the first content between <requestFlow>....</requestFlow> in match attribute and added the replaced value in replace attribute of replaceregexp task
I try to use property with maven-antrun-plugin.
But it seems to be blocked in some case (I had the similar problem with exec-maven-plugin :
It work with sudo mvn package : The script 0_init_livraison.ksh is executed. After this, execution, antrun asked me a question "Souhaitez-vous continuer ?" If the answer is yes, the build can continue. If the answer is no the script send an error message and the build is stopped.
It don't work with sudo mvn release:prepare : antrun ask the question and the build stay blocked (regardless of my answer)
I need to do a release
Here the concerned part of my pom.xml :
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>initialisation</id>
<phase>initialize</phase>
<configuration>
<tasks>
<exec dir="${project.basedir}"
executable="${project.basedir}/livraison/outils/0_init_livraison.ksh"
failonerror="false"
resultproperty="sortieInitScript">
<arg line="${project.name} ${project.version} ${ancienneVersion}" />
<redirector errorproperty="redirector.err" />
</exec>
<echo message="Resultat ${sortieInitScript}, Message ${redirector.err}"/>
<input message=" Souhaitez-vous Continuer ? "
validargs="o,n"
addproperty="procedureChoix" />
<fail message="ARRET VOLONTAIRE DE LA PROCEDURE !!">
<condition>
<equals arg1="${procedureChoix}" arg2="n" />
</condition>
</fail>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Here the concerned part of my 0_init_livraison.ksh :
...
echo -e "\n| FIN DU SCIPT "
echo -e " ============================================================"
echo "warning" 1>&2
The last lines of my console when i do a sudo mvn package :
[exec] | FIN DU SCIPT
[exec] ============================================================
[exec]
[echo] Resultat 0, Message warning
Souhaitez-vous Continuer ? (o, n)
o
[INFO] Executed tasks (<- this last line doesn't appear with mvn release:prepare. But it appears with mvn package)
...
Do i miss something with release command ?
Thanks for the reading :)
I created a maven project and i'm trying to run an external script.
In this external script, i use read command to ask a question and get an answer.
It works if i do a sudo mvn package with exec-maven-plugin
But, but, but :
If i do a sudo mvn package, my script doesn't stop at read command.
If i do a sudo mvn release:prepare with exec-maven-plugin, my script doesn't stop at read command.
If i do a sudo mvn release:prepare with maven-antrun-plugin, my script doesn't stop at read command.
And obviously, i need to do a release :)
I tried to to change the first line of my script (#/usr/bin/bash, sh, ...) with other syntaxes for read command...
Is anyone have a solution to help me ???
Here the concerned part of my pom.xml
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>initialisation</id>
<phase>initialize</phase>
<configuration>
<tasks>
<exec dir="${project.basedir}" executable="${project.basedir}/livraison/outils/0_init_livraison.ksh" failonerror="true">
<arg line="${project.name} ${project.version} ${ancienneVersion}" />
</exec>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Here the concerned part of my 0_init_livraison.ksh
#!/bin/ksh
echo -e "| EXECUTION DU SCIPT generation_livrable.ksh \n"
echo "SHELL : $SHELL"
boucle="boucler"
while [ $boucle -eq "boucler" ]
do
echo -ne " Souhaitez-vous forcer la procedure (oui/non)? "
read rep1
case "$rep1" in
o|O|y|Y|oui|Oui|OUI|yes|Yes|YES)
echo ""
break
;;
n|N|non|Non|NON|no|No|NO)
echo -e " Abandon de la procedure..."
boucle=""
exit 1
;;
*)
echo -e " Reponse incomprehensible.\c"
esac
done
The last lines of my console when i do a sudo mvn package ( And then, nothing happens. It seems blocked because of an infinite while loop)
[INFO] --- maven-antrun-plugin:1.8:run (initialisation) # MyProject---
[WARNING] Parameter tasks is deprecated, use target instead
[INFO] Executing tasks
main:
[exec] | EXECUTION DU SCIPT generation_livrable.ksh
[exec]
[exec] SHELL : /bin/bash
Thanks for the reading :)
EDIT :
I tried to use property with maven-antrun-plugin.
But i have a similar problem: antrun input task doesn't work during mvn release:prepare operation
EITHER
Set environment variable ANT_HOME, add a property to you Maven:
<property name="ant.home" value="${env.ANT_HOME}" /> and add a parameter vmlauncher="true" to your Ant Exec part.
OR
Exec ksh instead of script name with a script as a parameter. I mean:
<exec dir="${project.basedir}" executable="ksh" failonerror="true">
<arg value="${project.basedir}/livraison/outils/0_init_livraison.ksh">
</exec>
I tried to use Exec ksh instead of script name with a script as a parameterthose but it didn't work.
I tried to set ANT_HOME variable but it didn't work.
But i changed my way of thinking :
Having a build that depends on the console is extremely problematic, most integration tools around Maven will not work with it because they assume autonomous runs. This kind of maven project would encounter problems with Jenkins , Netbeans,... They cannot wait for manual answer.
The best way is to set an option and run a command with a parameter :
mvn clean packge -Dforcer=oui or mvn release:prepare -Darguments=-Dforcer=oui
Here a part of my pom.xml :
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>initialisation</id>
<phase>initialize</phase>
<configuration>
<tasks>
<exec executable="${outilsLivraison}/0_init_livraison.ksh" failonerror="false" resultproperty="codeRetour">
<redirector errorproperty="message.redirector.err" />
</exec>
<fail message=" ARRET DE LA PROCEDURE ! VOUS POUVEZ FORCER LA PROCEDURE AVEC '-Dforcer=oui' (ou '-Darguments=-Dforcer=oui' pour une release).">
<condition>
<and>
<equals arg1="${message.redirector.err}" arg2="warning" />
<not><equals arg1="${forcer}" arg2="oui" /></not>
</and>
</condition>
</fail>
<fail message=" Erreur">
<condition>
<equals arg1="${codeRetour}" arg2="1" />
</condition>
</fail>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Here a function which is called in my 0_init_livraison.ksh script when a problem is detected :
fonc_warning(){
echo "warning" 1>&2
}
So my problem is solved.
Anyway, thank's for your suggestions :)
i m using the wso2ESB 4.8.0 and i followed the sample at this url:
https://docs.wso2.org/display/ESB480/Sample+62:+Routing+a+Message+to+a+Dynamic+List+of+Recipients+and+Aggregating+Responses
writing this proxy service:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="adminBroadcastEndpoint"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<send>
<endpoint>
<recipientlist>
<endpoint>
<address uri="http://127.0.0.1:8080/RestService/rest/servizio/"/>
</endpoint>
<endpoint>
<address uri="http://127.0.0.1:8081/RestService/rest/servizio/"/>
</endpoint>
</recipientlist>
</endpoint>
</send>
<drop/>
</inSequence>
<outSequence>
<payloadFactory media-type="xml">
<format>
<broadcast>
$1
</broadcast>
</format>
<args>
<arg evaluator="xml" expression="$body/root"/>
</args>
</payloadFactory>
<aggregate>
<completeCondition>
<messageCount/>
</completeCondition>
<onComplete xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" expression="/">
<send/>
</onComplete>
</aggregate>
</outSequence>
</target>
<description/>
</proxy>
in the recipient list there are two servers who answer with an xml string. The first server answer with
<root>
<codice>0</codice>
<messaggio>MESSAGE1</messaggio>
<result><name>CorreggiPecJob1</name><group>POSTA1</group></result>
<result><name>SchedulaIndiceJob1</name><group>INDICE1</group></result>
</root>
and the second server with:
<root>
<codice>0</codice>
<messaggio>MESSAGE2</messaggio>
<result><name>CorreggiPecJob2</name><group>POSTA2</group></result>
<result><name>SchedulaIndiceJob2</name><group>INDICE2</group></result>
</root>
After the aggregate mediator i should expect a result with all those 2 message merged... but in the response from the proxy service i get just the second server answer or the first one randomly.
If i put a log mediator suddenly after the onComplete tag hawever i the esb prints the whole merged message with the two response, but it seems that on the send mediator something goes lost.
Why does this happen?
Another question is: why xpath expressions like
$body/broadcast//result
don't work rising this exception?
2014-03-02 17:37:32,021] ERROR - AggregateMediator Error evaluating expression: $body/broadcast//result
org.apache.synapse.SynapseException: Could not find matching elements to aggregate.
I realize that if i define a namespace and a prfix to append in the payloadfactory like:
<payloadFactory xmlns:m0="my.namespace" media-type="xml">
<m0:format>
<m0:broadcast>
$1
</m0:broadcast>
</m0:format>
<args>
<arg evaluator="xml" expression="$body/root"/>
</args>
</payloadFactory>
the expression: $body/m0:broadcast work fine... so is it the namespace definition mandatory?
Is it there anything i'm missing? thanks
If the XML elements are in namespaces, than you're XPath must either define and use namespace prefixes, or specify any namespace in the path steps, like this:
$body/*:broadcast
i found the answer here: wso2 ESB : Split / Gather Pattern - Single Response
i solved using the enrich mediator. But i think that the aggregate mediator has not a really correct behaviour... maybe should be checked.
Suppose I have a Web.config like such:
<configuration>
<elmah>
...
</elmah>
</configuration>
Is it possible to remove the <elmah> node with config transforms? So far I've tried something like:
<configuration>
<elmah xdt:Transfrom="RemoveAll"/>
</configuration>
Which doesn't work (according to Preview Transform). Althought this type of thing does seem to work on other nodes. Does anyone know how this can be removed?
Thanks
You need to have a xdt:Locator to get the match.
Try using the following:
Debug:
<configuration>
<elmah name="debug" />
</configuration>
Release:
<configuration>
<elmah name="debug" xdt:Locator="Match(name)" xdt:Transform="RemoveAll" />
</configuration>
Or without the need for name matching:
<configuration>
<elmah name="debug" xdt:Locator="XPath(//elmah)" xdt:Transform="RemoveAll" />
</configuration>
or
<configuration>
<elmah name="debug" xdt:Locator="XPath(configuration/elmah)" xdt:Transform="RemoveAll" />
</configuration>
As a note:
Currently the Web.config transforms are only applied during the Web Publish Pipleline (WPP) that is on Publish, not during debug, to enable them during debug check the following link: http://sedodream.com/2010/10/21/ASPNETWebProjectsWebdebugconfigWebreleaseconfig.aspx .
Hope it helps.
You have a typo in your xdt syntax – it should be xdt:Transform, not xdt:Transfrom.