Skip to content

Instantly share code, notes, and snippets.

@tonusoo
Last active September 7, 2025 20:09
Show Gist options
  • Select an option

  • Save tonusoo/55e43b2b4373b93de818a787823187b2 to your computer and use it in GitHub Desktop.

Select an option

Save tonusoo/55e43b2b4373b93de818a787823187b2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Configures Juniper router to inject a 0x0b control character to
# "Shutdown Communication" field(RFC 9003) of a BGP cease NOTIFICATION message.
#
# Usage example:
# ./shutdown-bgp-session.bash | ssh [email protected] -p 830 -s netconf
vertical_tab=$'\v'
cat << EOF
<rpc>
<edit-config>
<target>
<candidate/>
</target>
<default-operation>merge</default-operation>
<config>
<configuration>
<protocols>
<bgp>
<group>
<name>bgp-notif-msg-test</name>
<shutdown operation="create">
<notify-message>${vertical_tab}maintenance</notify-message>
</shutdown>
</group>
</bgp>
</protocols>
</configuration>
</config>
</edit-config>
</rpc>
]]>]]>
<rpc>
<commit/>
</rpc>
]]>]]>
<rpc>
<close-session/>
</rpc>
]]>]]>
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment