Last active
September 25, 2017 09:16
-
-
Save soyo42/c745e43282fdb68a45b4 to your computer and use it in GitHub Desktop.
odl-rest scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# init address | |
odlAddress=${ODL_ADDRESS:-localhost} | |
# init port | |
odlPort=${ODL_PORT:-8080} | |
if type resty 2>/dev/null | head -n 1 | grep 'is a function' >/dev/null; then | |
RESTY_LOADED=true | |
else | |
RESTY_LOADED=false | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this is project name keeper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
. resty | |
while read i; do | |
echo $i | |
$(./odl-inv-config $i) | |
POST < group1.xml | |
done < <(./listOperationalNodes.sh 2>/dev/null | sed -rn 's/^openflow:([0-9]+)$/\1/ p') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
. resty | |
while read i; do | |
echo $i | |
$(./odl-inv-config $i) | |
POST < meter-m1.xml | |
done < <(./listOperationalNodes.sh 2>/dev/null | sed -rn 's/^openflow:([0-9]+)$/\1/ p') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
. resty | |
while read i; do | |
echo $i | |
$(./odl-inv-config $i table/0) | |
POST < flow-f54t0.xml | |
done < <(./listOperationalNodes.sh 2>/dev/null | sed -rn 's/^openflow:([0-9]+)$/\1/ p') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
dsConfig="$(./dumpOFNodes-config)" | |
dsOperational="$(./dumpOFNodes-operational)" | |
# remove table-features | |
dsOperational="$(echo "${dsOperational}" | xsltproc ${SCRIPT_HOME}/filterRemoveTableFeatures.xslt -)" | |
function showDiffCnfOpr() { | |
echo -e "\e[35;1m------- $3 ------\e[0m" | |
if [ "$4" == "-" ]; then | |
diffuse <(echo '#DS/config'; echo "$1") <(echo '#DS/operational'; echo "$2") & | |
else | |
pr -m -t -W 112 <(echo '#DS/config'; echo "$1") <(echo '#DS/operational'; echo "$2") | |
fi | |
echo -ne "---\ntotal $(printf '%5s' $3) in DS/config | DS/operational: \e[35m" | |
echo "$1" | grep "$3" -c | tr -d '\n' | |
echo -n ' | ' | |
echo "$2" | grep "$3" -c | |
echo -en '\e[0m' | |
} | |
showDiffCnfOpr "$(echo "${dsConfig}" | ./listFlows-config -)" "$(echo "${dsOperational}" | ./listFlows-operational -)" 'FLOW' $1 | |
showDiffCnfOpr "$(echo "${dsConfig}" | ./listGroups-config -)" "$(echo "${dsOperational}" | ./listGroups-operational -)" 'GROUP' $1 | |
showDiffCnfOpr "$(echo "${dsConfig}" | ./listMeters-config -)" "$(echo "${dsOperational}" | ./listMeters-operational -)" 'METER' $1 | |
echo -e "\n\e[33;1m------- TOTALS ------\e[0m" | |
echo -ne '\e[0mtotal in DS/config.. \e[33m' | |
echo "${dsConfig}" | xsltproc ${SCRIPT_HOME}/filterNodesCount.xslt - | |
echo -ne '\e[0mtotal in DS/operational.. \e[33m' | |
echo "${dsOperational}" | xsltproc ${SCRIPT_HOME}/filterNodesCount.xslt - | |
echo -ne '\e[0msnapshot gathering marks in DS/operational.. \n\e[38;1m' | |
echo "${dsOperational}" | xsltproc ${SCRIPT_HOME}/filterNodeSnapshotStatus.xslt - | |
echo -en '\e[0m' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
. resty | |
while read i; do | |
echo $i | |
$(./odl-inv-config $i table/0) | |
DELETE | |
done < <(./listOperationalNodes.sh 2>/dev/null | sed -rn 's/^openflow:([0-9]+)$/\1/ p') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_ROOT_REL="$(dirname "$0")" | |
echo -e "\e[32mpulling links from:\e[32;1m [${SCRIPT_ROOT_REL}]\e[0m" | |
ln -sv "${SCRIPT_ROOT_REL}/addAllTableMissEntries.sh" addAll-tableMissEntries | |
ln -sv "${SCRIPT_ROOT_REL}/cleanAll0Tables.sh" cleanAll-0Tables | |
ln -sv "${SCRIPT_ROOT_REL}/addAllGroups.sh" addAll-groups | |
ln -sv "${SCRIPT_ROOT_REL}/addAllMeters.sh" addAll-meters | |
ln -sv "${SCRIPT_ROOT_REL}/dumpOFNodes.sh" dumpOFNodes-config | |
ln -sv "${SCRIPT_ROOT_REL}/dumpOFNodes.sh" dumpOFNodes-operational | |
ln -sv "${SCRIPT_ROOT_REL}/listFlows.sh" listFlows-operational | |
ln -sv "${SCRIPT_ROOT_REL}/listFlows.sh" listFlows-config | |
ln -sv "${SCRIPT_ROOT_REL}/listGroups.sh" listGroups-operational | |
ln -sv "${SCRIPT_ROOT_REL}/listGroups.sh" listGroups-config | |
ln -sv "${SCRIPT_ROOT_REL}/listMeters.sh" listMeters-operational | |
ln -sv "${SCRIPT_ROOT_REL}/listMeters.sh" listMeters-config | |
ln -sv "${SCRIPT_ROOT_REL}/topologyDumper.sh" dump-topology | |
ln -sv "${SCRIPT_ROOT_REL}/entityOwnershipDumper.sh" entityOwnershipDumper | |
ln -sv "${SCRIPT_ROOT_REL}/ODLoperations.sh" odlOperations | |
ln -sv "${SCRIPT_ROOT_REL}/listOperationalNodes.sh" | |
ln -sv "${SCRIPT_ROOT_REL}/flow-f54t0.xml" | |
ln -sv "${SCRIPT_ROOT_REL}/meter-m1.xml" | |
ln -sv "${SCRIPT_ROOT_REL}/group1.xml" | |
ln -sv "${SCRIPT_ROOT_REL}/allBrief.sh" allBrief | |
ln -sv "${SCRIPT_ROOT_REL}/ODLinventory.sh" odl-inv-operational | |
ln -sv "${SCRIPT_ROOT_REL}/ODLinventory.sh" odl-inv-config | |
ln -sv "${SCRIPT_ROOT_REL}/OdlNcContext.sh" odlNCTopology-operational | |
ln -sv "${SCRIPT_ROOT_REL}/OdlNcContext.sh" odlNCTopology-config | |
ln -sv "${SCRIPT_ROOT_REL}/netconfTopologyDumper.sh" dump-topo-netconf-operational | |
ln -sv "${SCRIPT_ROOT_REL}/netconfTopologyDumper.sh" dump-topo-netconf-config | |
ln -sv "${SCRIPT_ROOT_REL}/ODLtopology.sh" odl-topo-operational | |
ln -sv "${SCRIPT_ROOT_REL}/ODLtopology.sh" odl-topo-config | |
ln -sv "${SCRIPT_ROOT_REL}/walkClusterTopology.sh" walkClusterTopology-operational | |
ln -sv "${SCRIPT_ROOT_REL}/walkClusterTopology.sh" walkClusterTopology-config | |
ln -sv "${SCRIPT_ROOT_REL}/walkClusterCmd.sh" walkClusterCmd | |
if [ ! -h 'resty' ]; then | |
echo -e '\e[32msucking RESTY ..\e[0m' | |
localResty="resty-$(date +'%Y%m%d')" | |
if [ ! -f "${localResty}" ]; then | |
wget http://github.com/micha/resty/raw/master/resty -O ${localResty} | |
else | |
echo -e "\e[33mresty already downloaded: \e[33;1m${localResty}\e[0m" | |
fi | |
ln -sf ${localResty} resty | |
else | |
echo -e "\e[33msymbolic link to resty already present: \e[33;1mSKIPPING resty download\e[0m" | |
fi | |
localhostEnv='.karaf-localhost' | |
echo -e '\e[32mcreating shortcut for \e[32;1mLOCALHOST ENV\e[0m' | |
if [ ! -f "${localhostEnv}" ]; then | |
cat > .karaf-localhost <<EOF | |
export ODL_PORT=8181 | |
export ODL_ADDRESS=localhost | |
EOF | |
else | |
echo -e "\e[33mLOCALHOST ENV already created: \e[33;1m${localhostEnv}\e[0m" | |
fi | |
echo -e '\e[32mOPTIONAL: \e[32;1mcreating resty profiles\e[0m' | |
echo -en '\e[44m' | |
echo '# copy default profile:' | |
echo " mkdir ~/.resty" | |
echo " cp ${SCRIPT_ROOT_REL}/localhost:8080* ~/.resty/" | |
echo ' ln -s $(readlink -f .)/resty ~/bin/restySRC' | |
echo " cp ${SCRIPT_ROOT_REL}/POST-* ${SCRIPT_ROOT_REL}/PUT-* ${SCRIPT_ROOT_REL}/GET-* ~/bin/" | |
echo '# eventually create symbolic links like:' | |
echo ' cd ~/.resty' | |
echo ' ln -s localhost:8080_noContent localhost:8181' | |
echo ' ln -s localhost:8080_noContent 10.1.2.3:8181' | |
echo -n ' cd -' | |
echo -e '\e[0m' | |
echo -e '\e[32m-- DONE --\e[0m' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
key="${0##*-}" | |
. resty | |
$(./odl-inv-${key}) | |
GET |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
restyMagic='source restySRC -W' | |
. ${SCRIPT_HOME}/.init | |
${restyMagic} http://${odlAddress}:${odlPort}/restconf/operational/entity-owners:entity-owners | |
. GET-xml | xsltproc ${SCRIPT_HOME}/filterEntityOwnership.xslt - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:ceo="urn:opendaylight:params:xml:ns:yang:controller:md:sal:clustering:entity-owners"> | |
<xsl:output method="text"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="//ceo:entity-type"> | |
<xsl:sort select="ceo:type" data-type="text"/> | |
</xsl:apply-templates> | |
</xsl:template> | |
<xsl:template match="ceo:entity-type"> | |
<xsl:text>--- TYPE [</xsl:text> | |
<xsl:value-of select="./ceo:type/text()" /> | |
<xsl:text>] | |
</xsl:text> | |
<xsl:for-each select="./ceo:entity"> | |
<xsl:apply-templates select="."/> | |
</xsl:for-each> | |
</xsl:template> | |
<xsl:template match="ceo:entity"> | |
<xsl:text> ID : </xsl:text> | |
<xsl:value-of select="./ceo:id/text()" /> | |
<xsl:text> | |
</xsl:text> | |
<xsl:text> +-- OWNER: </xsl:text> | |
<xsl:value-of select="./ceo:owner/text()" /> | |
<xsl:text> | |
</xsl:text> | |
<xsl:for-each select="./ceo:candidate"> | |
<xsl:apply-templates select="."/> | |
</xsl:for-each> | |
</xsl:template> | |
<xsl:template match="ceo:candidate"> | |
<xsl:text> candidate: </xsl:text> | |
<xsl:value-of select="./ceo:name/text()" /> | |
<xsl:text> | |
</xsl:text> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology" | |
xmlns:n-topo="urn:opendaylight:netconf-node-topology"> | |
<xsl:output method="text"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:text>--- NODES [</xsl:text><xsl:value-of select="count(//topo:node)"/><xsl:text>]--- | |
</xsl:text> | |
<xsl:apply-templates select="//topo:node"/> | |
<xsl:text>--- LINKS [</xsl:text><xsl:value-of select="count(//topo:link)"/><xsl:text>]--- | |
</xsl:text> | |
<xsl:apply-templates select="//topo:link"/> | |
</xsl:template> | |
<xsl:template match="topo:node"> | |
<xsl:value-of select="./topo:node-id/text()" /> | |
<xsl:text> .. </xsl:text> | |
<xsl:value-of select="./n-topo:connection-status/text()" /> | |
<xsl:text> | |
-> </xsl:text> | |
<xsl:value-of select="./n-topo:host/text()" /> | |
<xsl:text> : </xsl:text> | |
<xsl:value-of select="./n-topo:port/text()" /> | |
<xsl:if test="./n-topo:current-owner-id"> | |
<xsl:text> | |
current-owner-id: </xsl:text> | |
<xsl:value-of select="./n-topo:current-owner-id/text()" /> | |
</xsl:if> | |
<xsl:text> | |
</xsl:text> | |
<xsl:apply-templates select="./n-topo:cluster-node-status"/> | |
<xsl:apply-templates select="./n-topo:clustered-connection-status"/> | |
<xsl:apply-templates select="./topo:termination-point"/> | |
</xsl:template> | |
<xsl:template match="topo:termination-point"> | |
<xsl:text> </xsl:text> | |
<xsl:value-of select="./topo:tp-id/text()" /> | |
<xsl:text> | |
</xsl:text> | |
</xsl:template> | |
<xsl:template match="n-topo:cluster-node-status"> | |
<xsl:text> #owner: </xsl:text> | |
<xsl:value-of select="./n-topo:owner-id"/> | |
<xsl:text> | |
connection-status: </xsl:text> | |
<xsl:value-of select="./n-topo:connection-status/text()" /> | |
<xsl:text> | |
</xsl:text> | |
</xsl:template> | |
<xsl:template match="n-topo:clustered-connection-status"> | |
<xsl:for-each select="n-topo:node-status"> | |
<xsl:sort select="./n-topo:node/text()"/> | |
<xsl:text> connection-status=</xsl:text> | |
<xsl:value-of select="./n-topo:node/text()" /> | |
<xsl:text> --> </xsl:text> | |
<xsl:value-of select="./n-topo:status/text()" /> | |
<xsl:text> | |
</xsl:text> | |
</xsl:for-each> | |
</xsl:template> | |
<xsl:template match="topo:link"> | |
<xsl:value-of select="./topo:link-id/text()" /> | |
<xsl:text> : </xsl:text> | |
<xsl:value-of select="./topo:source/topo:source-tp/text()" /> | |
<xsl:text> --> </xsl:text> | |
<xsl:value-of select="./topo:destination/topo:dest-node/text()" /> | |
<xsl:text>|</xsl:text> | |
<xsl:value-of select="./topo:destination/topo:dest-tp/text()" /> | |
<xsl:text> | |
</xsl:text> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:inv="urn:opendaylight:inventory"> | |
<xsl:output method="text"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="/inv:nodes/inv:node"/> | |
</xsl:template> | |
<xsl:template match="inv:node"> | |
<xsl:value-of select="./inv:id/text()" /> | |
<xsl:text> | |
</xsl:text> | |
<xsl:apply-templates select="./inv:node-connector"/> | |
<xsl:text> -- | |
</xsl:text> | |
</xsl:template> | |
<xsl:template match="inv:node-connector"> | |
<xsl:value-of select="./inv:id/text()" /> | |
<xsl:text> | |
</xsl:text> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:inv="urn:opendaylight:inventory" | |
xmlns:flownode="urn:opendaylight:flow:inventory"> | |
<xsl:output method="text"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="/inv:nodes/inv:node"> | |
<xsl:sort select="inv:id" data-type="text"/> | |
</xsl:apply-templates> | |
</xsl:template> | |
<xsl:template match="inv:node"> | |
<xsl:text>NODE[</xsl:text> | |
<xsl:variable name="nodeId"><xsl:value-of select="./inv:id/text()" /></xsl:variable> | |
<xsl:value-of select="$nodeId"/>] <xsl:value-of select="./flownode:ip-address"/> cons#:<xsl:value-of select="count(./inv:node-connector)"/>, tables#:<xsl:value-of select="count(./flownode:table)"/><xsl:text> | |
</xsl:text> | |
<xsl:apply-templates select="./flownode:table[./flownode:flow]"> | |
<xsl:sort select="flownode:id" data-type="number"/> | |
<xsl:with-param name="nodeId" select="$nodeId"/> | |
</xsl:apply-templates> | |
</xsl:template> | |
<xsl:template match="flownode:table"> | |
<xsl:param name="nodeId"/> | |
<xsl:variable name="tableId"><xsl:value-of select="./flownode:id/text()" /></xsl:variable> | |
<xsl:text> TABLE[</xsl:text> | |
<xsl:value-of select="$tableId" /><xsl:text>] flows#:</xsl:text> | |
<xsl:value-of select="count(./flownode:flow)" /> | |
<xsl:text> | |
</xsl:text> | |
<xsl:apply-templates select="./flownode:flow"> | |
<xsl:sort select="flownode:id" data-type="text"/> | |
<xsl:with-param name="nodeId" select="$nodeId"/> | |
<xsl:with-param name="tableId" select="$tableId"/> | |
</xsl:apply-templates> | |
</xsl:template> | |
<xsl:template match="flownode:flow"> | |
<xsl:param name="nodeId"/> | |
<xsl:param name="tableId"/> | |
<xsl:text> FLOW[</xsl:text><xsl:value-of select="./flownode:id/text()"/> | |
<xsl:text>] | |
</xsl:text> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:inv="urn:opendaylight:inventory" | |
xmlns:flownode="urn:opendaylight:flow:inventory"> | |
<xsl:output method="text"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="/inv:nodes/inv:node"> | |
<xsl:sort select="inv:id" data-type="text"/> | |
</xsl:apply-templates> | |
</xsl:template> | |
<xsl:template match="inv:node"> | |
<xsl:text>NODE[</xsl:text> | |
<xsl:variable name="nodeId"><xsl:value-of select="./inv:id/text()" /></xsl:variable> | |
<xsl:value-of select="$nodeId"/><xsl:text>] groups#:</xsl:text> | |
<xsl:value-of select="count(./flownode:group)" /> | |
<xsl:text> | |
</xsl:text> | |
<xsl:apply-templates select="./flownode:group"> | |
<xsl:sort select="flownode:group-id" data-type="number"/> | |
</xsl:apply-templates> | |
</xsl:template> | |
<xsl:template match="flownode:group"> | |
<xsl:variable name="groupId"><xsl:value-of select="./flownode:group-id/text()" /></xsl:variable> | |
<xsl:text> GROUP[</xsl:text> | |
<xsl:value-of select="$groupId"/> | |
<xsl:text>] buckets#:</xsl:text><xsl:value-of select="count(.//flownode:bucket)"/><xsl:text> | |
</xsl:text> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:inv="urn:opendaylight:inventory" | |
xmlns:flownode="urn:opendaylight:flow:inventory"> | |
<xsl:output method="text"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="/inv:nodes/inv:node"> | |
<xsl:sort select="inv:id" data-type="text"/> | |
</xsl:apply-templates> | |
</xsl:template> | |
<xsl:template match="inv:node"> | |
<xsl:text>NODE[</xsl:text> | |
<xsl:variable name="nodeId"><xsl:value-of select="./inv:id/text()" /></xsl:variable> | |
<xsl:value-of select="$nodeId"/><xsl:text>] meters#:</xsl:text> | |
<xsl:value-of select="count(./flownode:meter)" /> | |
<xsl:text> | |
</xsl:text> | |
<xsl:apply-templates select="./flownode:meter"/> | |
</xsl:template> | |
<xsl:template match="flownode:meter"> | |
<xsl:variable name="meterId"><xsl:value-of select="./flownode:meter-id/text()" /></xsl:variable> | |
<xsl:text> METER[</xsl:text> | |
<xsl:value-of select="$meterId"/> | |
<xsl:text>] | |
</xsl:text> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:inv="urn:opendaylight:inventory" | |
xmlns:flownode="urn:opendaylight:flow:inventory"> | |
<xsl:output method="text"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:text>NODES : </xsl:text> | |
<xsl:value-of select="count(/inv:nodes/inv:node)" /> | |
<xsl:text> | |
</xsl:text> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:inv="urn:opendaylight:inventory" | |
xmlns:flow="urn:opendaylight:flow:inventory"> | |
<xsl:output method="text"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:apply-templates select="/inv:nodes/inv:node"> | |
<xsl:sort select="./inv:id" data-type="text"/> | |
</xsl:apply-templates> | |
</xsl:template> | |
<xsl:template match="inv:node"> | |
<xsl:text>NODE[</xsl:text> | |
<xsl:value-of select="./inv:id/text()" /> | |
<xsl:text>] </xsl:text> | |
<xsl:choose> | |
<xsl:when test="./flow:snapshot-gathering-status-start"> | |
<xsl:text><</xsl:text> | |
<xsl:value-of select="./flow:snapshot-gathering-status-start/flow:begin/text()"/> | |
<xsl:text> .. </xsl:text> | |
<xsl:apply-templates select="./flow:snapshot-gathering-status-end"/> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:text>N/A</xsl:text> | |
</xsl:otherwise> | |
</xsl:choose> | |
<xsl:text> | |
</xsl:text> | |
</xsl:template> | |
<xsl:template match="flow:snapshot-gathering-status-end"> | |
<xsl:value-of select="./flow:end/text()"/> | |
<xsl:text>> SUCCEEDED=</xsl:text> | |
<xsl:value-of select="./flow:succeeded/text()"/> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:table="urn:opendaylight:flow:inventory"> | |
<xsl:output omit-xml-declaration="yes"/> | |
<xsl:template match="node()|@*"> | |
<xsl:copy> | |
<xsl:apply-templates select="node()|@*"/> | |
</xsl:copy> | |
</xsl:template> | |
<xsl:template match="table:table-features"/> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:topo="urn:TBD:params:xml:ns:yang:network-topology"> | |
<xsl:output method="text"/> | |
<xsl:strip-space elements="*"/> | |
<xsl:template match="/"> | |
<xsl:text>--- NODES [</xsl:text><xsl:value-of select="count(//topo:node)"/><xsl:text>]--- | |
</xsl:text> | |
<xsl:apply-templates select="//topo:node"/> | |
<xsl:text>--- LINKS [</xsl:text><xsl:value-of select="count(//topo:link)"/><xsl:text>]--- | |
</xsl:text> | |
<xsl:apply-templates select="//topo:link"/> | |
</xsl:template> | |
<xsl:template match="topo:node"> | |
<xsl:text>[</xsl:text> | |
<xsl:value-of select="./topo:node-id/text()" /> | |
<xsl:text>] | |
</xsl:text> | |
<xsl:apply-templates select="./topo:termination-point"/> | |
</xsl:template> | |
<xsl:template match="topo:termination-point"> | |
<xsl:text> </xsl:text> | |
<xsl:value-of select="./topo:tp-id/text()" /> | |
<xsl:text> | |
</xsl:text> | |
</xsl:template> | |
<xsl:template match="topo:link"> | |
<xsl:value-of select="./topo:source/topo:source-tp/text()" /> | |
<xsl:text> --> </xsl:text> | |
<xsl:value-of select="./topo:destination/topo:dest-tp/text()" /> | |
<xsl:text> | |
</xsl:text> | |
</xsl:template> | |
</xsl:stylesheet> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<flow xmlns="urn:opendaylight:flow:inventory"> | |
<barrier>false</barrier> | |
<cookie>54</cookie> | |
<flags>SEND_FLOW_REM</flags> | |
<flow-name>FooXf54</flow-name> | |
<hard-timeout>0</hard-timeout> | |
<id>4242</id> | |
<idle-timeout>0</idle-timeout> | |
<installHw>false</installHw> | |
<instructions> | |
<instruction> | |
<apply-actions> | |
<action> | |
<output-action> | |
<max-length>65535</max-length> | |
<output-node-connector>CONTROLLER</output-node-connector> | |
</output-action> | |
<order>0</order> | |
</action> | |
</apply-actions> | |
<order>0</order> | |
</instruction> | |
</instructions> | |
<match/> | |
<priority>0</priority> | |
<strict>false</strict> | |
<table_id>0</table_id> | |
</flow> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GET -H "Accept: application/json" | jq '.' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GET -H "Accept: application/xml" | xmllint --format - | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<group xmlns="urn:opendaylight:flow:inventory"> | |
<barrier>false</barrier> | |
<buckets> | |
<bucket> | |
<action> | |
<pop-vlan-action/> | |
<order>0</order> | |
</action> | |
<bucket-id>12</bucket-id> | |
<watch_group>14</watch_group> | |
<watch_port>1234</watch_port> | |
<weight>50</weight> | |
</bucket> | |
</buckets> | |
<group-id>1</group-id> | |
<group-name>Foo</group-name> | |
<group-type>group-select</group-type> | |
</group> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OPENDAYLIGHT restconf scripts | |
============================= | |
Requirements | |
- bash | |
- curl | |
- wget | |
- resty (https://github.com/micha/resty) | |
- xsltproc | |
- (running odl-controller with connected (mininet) devices) | |
Quickstart | |
- create and enter restconf workfolder (restyLab) | |
mkdir restyLab; cd restyLab | |
- clone ODL restconf scripts | |
git clone <actual url> odlResty | |
- create work folder | |
mkdir work; cd work | |
- create links and environment | |
../odlResty/createLinks.sh | |
- finish the manual copying of resty profiles if necessary (see output of createLinks script) | |
- source resty and prepare environment variables | |
. resty | |
. .karaf-localhost | |
- check out your odl-controller output | |
./allBrief | |
Basic restconf stuff | |
==================== | |
Write flow into DS/config and check. | |
1: now let's get config of node with id=openflow:1 | |
$(./odl-inv-config 1) | |
GET | |
2: now let's add flow into node with id=openflow:1, table 0 | |
$(./odl-inv-config 1 table/0) | |
POST < flow-f54t0.xml | |
3: now let's inspect this flow in operational of node with id=openflow:1, table 0 | |
$(./odl-inv-operational 1 table/0) | |
GET | |
(to get pretty output, use GET | xmllint --format - or GET | python -m json.tool) | |
Adding table miss entries | |
========================= | |
This can be done either | |
- manually by POSTing the flow-f54t0.xml flow to each device into table.id=0 | |
- or by invoking script | |
./addAll-tableMissEntries | |
- and cleaning all table.id=0 | |
./cleanAll-0Tables | |
List flows | |
========== | |
./listFlows-config | |
./listFlows-operational | grep 'FLOW' | |
List operational nodes | |
====================== | |
./listNodes | |
Brief status config vs. operational | |
=================================== | |
On the left there is config and on the right there is operational context, summary is at the bottom. | |
./allBrief | |
Operations - RPC | |
================ | |
In order to set resty uri to rpc via restconf following script can be used | |
(contains just some basic set of uris). If you know the number of rpc than | |
you can use it as input parameter without using the interactive menu. | |
$(./odlOperations) | |
$(./odlOperations 1) | |
Now you should use somthing like POST < rpcInput.xml | |
Watching result | |
=============== | |
Output of any command can be watched (detault interval = 2s, see man watch). | |
- ugly oneliner | |
watch -d 'bash -c ". ./resty; $(./odl-inv-operational 1 table/0/flow-table-statistics); GET | xmllint --format -; date"' | |
- the same task (+another) node but via additional script (e.g. getStatsOf1_2) | |
cat > getStatsOf1_2 <<EOF | |
#!/bin/bash | |
. ./resty | |
. .karaf-local | |
$(./odl-inv-operational 1 table/0/flow-table-statistics) | |
GET | xmllint --format - | |
$(./odl-inv-operational 2 table/0/flow-table-statistics) | |
GET | xmllint --format - | |
EOF | |
- now we can start watching the result | |
watch -d './getStatsOf1_2' | |
Watching result 2 | |
================= | |
Lets watch topology links: | |
watch -d './dump-topology | sed -rn '/LINKS/,$ p' | sort | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
key="${0##*-}" | |
if [ "$1" == '-' ]; then | |
cat /dev/stdin | xsltproc ${SCRIPT_HOME}/filterNodeFlow.xslt - | |
else | |
./dumpOFNodes-${key} | xsltproc ${SCRIPT_HOME}/filterNodeFlow.xslt - | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
key="${0##*-}" | |
if [ "$1" == '-' ]; then | |
cat /dev/stdin | xsltproc ${SCRIPT_HOME}/filterNodeGroup.xslt - | |
else | |
./dumpOFNodes-${key} | xsltproc ${SCRIPT_HOME}/filterNodeGroup.xslt - | |
fi | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
key="${0##*-}" | |
if [ "$1" == '-' ]; then | |
cat /dev/stdin | xsltproc ${SCRIPT_HOME}/filterNodeMeter.xslt - | |
else | |
./dumpOFNodes-${key} | xsltproc ${SCRIPT_HOME}/filterNodeMeter.xslt - | |
fi | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
key='operational' | |
./dumpOFNodes-${key} | xsltproc ${SCRIPT_HOME}/filterNode.xslt - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET -H "Accept: application/json" -u admin:admin -m 30 -0 | |
POST -H "Content-Type: application/json" -H "Accept: application/json" -u admin:admin -m 30 -0 | |
PUT -H "Content-Type: application/json" -H "Accept: application/json" -u admin:admin -m 30 -0 | |
DELETE -H "Content-Type: application/json" -u admin:admin -m 30 -v -0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET -u admin:admin -m 30 -v -0 | |
POST -u admin:admin -m 30 -v -0 | |
PUT -u admin:admin -m 30 -v -0 | |
DELETE -u admin:admin -m 30 -v -0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET -H "Accept: application/xml" -u admin:admin -m 30 -v | |
POST -H "Content-Type: application/xml" -H "Accept: application/xml" -u admin:admin -m 30 -v | |
PUT -H "Content-Type: application/xml" -H "Accept: application/xml" -u admin:admin -m 30 -v | |
DELETE -H "Content-Type: application/xml" -u admin:admin -m 30 -v |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<meter xmlns="urn:opendaylight:flow:inventory"> | |
<container-name>abcd</container-name> | |
<flags>meter-burst</flags> | |
<meter-band-headers> | |
<meter-band-header> | |
<band-burst-size>444</band-burst-size> | |
<band-id>0</band-id> | |
<band-rate>234</band-rate> | |
<dscp-remark-burst-size>5</dscp-remark-burst-size> | |
<dscp-remark-rate>12</dscp-remark-rate> | |
<prec_level>1</prec_level> | |
<meter-band-types> | |
<flags>ofpmbt-dscp-remark</flags> | |
</meter-band-types> | |
</meter-band-header> | |
</meter-band-headers> | |
<meter-id>1</meter-id> | |
<meter-name>Foo</meter-name> | |
</meter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
restyMagic='source restySRC -W' | |
context="${0##*-}" | |
. ${SCRIPT_HOME}/.init | |
${restyMagic} http://${odlAddress}:${odlPort}/restconf/${context}/network-topology:network-topology/topology/topology-netconf | |
. GET-xml | xsltproc ${SCRIPT_HOME}/filterNetconfTopology.xslt - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -h "$0" ]; then | |
echo "use symbolic link" | |
exit 1 | |
fi | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
restyMagic='resty' | |
context="${0##*-}" | |
. ${SCRIPT_HOME}/.init | |
if ! ${RESTY_LOADED}; then | |
restyMagic='source restySRC -W' | |
fi | |
switchId='' | |
if [ -n "$1" ]; then | |
switchId="node/openflow:$1/" | |
shift | |
fi | |
suffix="$1" | |
echo "${restyMagic} http://${odlAddress}:${odlPort}/restconf/${context}/opendaylight-inventory:nodes/${switchId}${suffix}" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -h "$0" ]; then | |
echo "use symbolic link" | |
exit 1 | |
fi | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
restyMagic='resty' | |
context="${0#*-}" | |
. ${SCRIPT_HOME}/.init | |
if ! ${RESTY_LOADED}; then | |
restyMagic='source restySRC -W' | |
fi | |
if [[ "${1:0:2}" == '--' ]]; then | |
echo "usage:: $0 [nodeId [custom suffix]] -> point url to ${context} context and specified node of coss mount point" | |
echo "usage:: $0 - [nodeId [custom suffix]] -> point url to ${context} context and coss mount point to specified config node" | |
echo "usage:: $0 -> point url to ${context} context, coss mount point" | |
echo "usage:: $0 --help -> display this help" | |
exit 1 | |
fi | |
nodePart='controller-config/yang-ext:mount/config:modules' | |
topoOnly=false | |
if [ -n "$1" ]; then | |
if [[ "$1" != '-' ]]; then | |
nodePart="$1" | |
else | |
nodePart="${nodePart}/module/odl-sal-netconf-connector-cfg:sal-netconf-connector" | |
topoOnly=true | |
fi | |
shift | |
fi | |
custom= | |
if [ -n "$1" ]; then | |
if ${topoOnly}; then | |
custom="$1" | |
else | |
custom="yang-ext:mount/$1" | |
fi | |
fi | |
echo "${restyMagic} http://${odlAddress}:${odlPort}/restconf/${context}/network-topology:network-topology/topology/topology-netconf/node/${nodePart}/${custom}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -h "$0" ]; then | |
echo "use symbolic link" | |
exit 1 | |
fi | |
restyMagic='resty' | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
. ${SCRIPT_HOME}/.init | |
if ! ${RESTY_LOADED}; then | |
restyMagic='source restySRC -W' | |
fi | |
rpcs=( \ | |
'sal-group:add-group' | |
'sal-group:remove-group' \ | |
'sal-flow:add-flow' \ | |
'sal-flow:update-flow' \ | |
'sal-flow:remove-flow' \ | |
'sal-table:update-table' \ | |
'packet-processing:transmit-packet' \ | |
'sal-port:update-port' \ | |
'sal-echo:send-echo' \ | |
'flow-capable-transaction:send-barrier' \ | |
'lldp-speaker:get-operational-status' \ | |
'lldp-speaker:change-operational-status' \ | |
'of-operational-status:get-operational-status' \ | |
'of-operational-status:change-operational-status' \ | |
'statistics-manager-control:get-statistics-work-mode' \ | |
'statistics-manager-control:change-statistics-work-mode' \ | |
'sal-bulk-flow:add-flows-rpc' \ | |
'sal-bulk-flow:remove-flows-rpc' \ | |
'sal-bulk-flow:add-flows-ds' \ | |
'sal-bulk-flow:remove-flows-ds' \ | |
'sal-flow-bulk:add-flows' \ | |
$(if [ -f '.operations' ]; then cat .operations; fi) | |
) | |
if [ -n "$1" ]; then | |
rpc=${rpcs[(($1-1))]} | |
else | |
select i in ${rpcs[@]}; do | |
#echo ${i} | |
rpc=${i} | |
break | |
done | |
fi | |
echo "${restyMagic} http://${odlAddress}:${odlPort}/restconf/operations/${rpc}" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -h "$0" ]; then | |
echo "use symbolic link" | |
exit 1 | |
fi | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
restyMagic='resty' | |
context="${0##*-}" | |
. ${SCRIPT_HOME}/.init | |
if ! ${RESTY_LOADED}; then | |
restyMagic='source restySRC -W' | |
fi | |
if [ -n "$1" ]; then | |
topologyId="topology/$1" | |
shift | |
fi | |
if [ -n "$1" ]; then | |
nodeSuffix="/node/$1" | |
shift | |
fi | |
echo "${restyMagic} http://${odlAddress}:${odlPort}/restconf/${context}/network-topology:network-topology/${topologyId}${nodeSuffix}" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
POST -H "Accept: application/json" -H "Content-type: application/json" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
POST -H "Content-type: application/xml" -H "Accept: application/xml" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PUT -H "Accept: application/json" -H "Content-type: application/json" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PUT -H "Content-type: application/xml" -H "Accept: application/xml" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
restyMagic='resty' | |
. ${SCRIPT_HOME}/.init | |
if ! ${RESTY_LOADED}; then | |
restyMagic='source restySRC -W' | |
fi | |
topoId='flow:1' | |
if [ -n "$1" ]; then | |
topoId="$1" | |
fi | |
${restyMagic} http://${odlAddress}:${odlPort}/restconf/operational/network-topology:network-topology/topology/${topoId} | |
. GET-xml | xsltproc ${SCRIPT_HOME}/filterTopology.xslt - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -h "$0" ]; then | |
echo "use symbolic link" | |
exit 1 | |
fi | |
if [ -z "$2" ]; then | |
echo "usage:: $0 <file containing cluster nodes config - one per line> <local command>" | |
exit 2 | |
fi | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
restyMagic='resty' | |
clusterDef=$1 | |
shift | |
. ${SCRIPT_HOME}/.init | |
. ${restyMagic} | |
while read cluster; do | |
echo -e "\033[33;1m$cluster\033[0m" | |
date | |
. ${cluster} | |
$@ | |
echo $? | |
done < <(cat ${clusterDef}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -h "$0" ]; then | |
echo "use symbolic link" | |
exit 1 | |
fi | |
if [ -z "$1" ]; then | |
echo "usage:: $0 <file containing cluster nodes config - one per line>" | |
exit 2 | |
fi | |
SCRIPT_HOME=$(dirname $(readlink -f $0)) | |
restyMagic='resty' | |
context="${0#*-}" | |
. ${SCRIPT_HOME}/.init | |
while read cluster; do | |
echo -e "\033[33;1m$cluster\033[0m" | |
. ${cluster} | |
./ncTopologyDumper-${context} | |
done < <(cat $1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment