Developer Guide¶
Setup Development Environment¶
Install
pip
andtox
:sudo apt-get install python-pip sudo pip install tox
Configure git pre-commit hook:
sudo pip install flake8 pep8-naming flake8 --install-hook git config flake8.strict true
Building Documentation¶
tox -e doc
Output will be available at .tox/doc/tmp/html
. It is recommended to install
the webdev
package:
sudo pip install webdev
So a development web server can serve any location like this:
$ webdev .tox/doc/tmp/html
Running Test Suite¶
tox -e py27,py34
topology_connect
¶
topology_connect module entry point.
Submodules¶
topology_connect.node
¶
topology_connect base node module.
Classes¶
ConnectNode
: Base node class for Topology Connect.CommonConnectNode
: Common Connect Node class for Topology Connect.
-
class
topology_connect.node.
ConnectNode
(identifier, **kwargs)¶ Base node class for Topology Connect.
See
topology.platform.CommonNode
for more information.Inheritance
-
start
()¶ Starts the Node.
-
stop
()¶ Stops the Node.
-
-
class
topology_connect.node.
CommonConnectNode
(identifier, **kwargs)¶ Common Connect Node class for Topology Connect.
This class will automatically auto-connect to all its shells on start and disconnect on stop.
See
topology_connect.platform.ConnectNode
for more information.Inheritance
-
start
()¶ Connect to all node shells.
-
stop
()¶ Disconnect from all node shells.
-
topology_connect.platform
¶
topology_connect engine platform module for topology.
Classes¶
ConnectPlatform
: FIXME: Document.
-
class
topology_connect.platform.
ConnectPlatform
(timestamp, nmlmanager)¶ FIXME: Document.
Inheritance
-
add_bilink
(nodeport_a, nodeport_b, bilink)¶ Add a link between two nodes.
See
BasePlatform.add_bilink()
for more information.
-
add_biport
(node, biport)¶ See
BasePlatform.add_biport()
for more information.
-
add_node
(node)¶ See
BasePlatform.add_node()
for more information.
-
destroy
()¶ See
BasePlatform.destroy()
for more information.
-
post_build
()¶ See
BasePlatform.post_build()
for more information.
-
pre_build
()¶ See
BasePlatform.pre_build()
for more information.
-
relink
(link_id)¶ See
BasePlatform.relink()
for more information.
-
rollback
(stage, enodes, exception)¶ See
BasePlatform.rollback()
for more information.
-
unlink
(link_id)¶ See
BasePlatform.unlink()
for more information.
-
topology_connect.shell
¶
topology_connect shell management module.
Classes¶
SshMixin
: SSH connection mixin for the Topology shell API.TelnetMixin
: Telnet connection mixin for the Topology shell API.SshShell
: Simple class mixing the pexcept based shell with the SSH mixin.TelnetShell
: Simple class mixing the pexcept based shell with the Telnet mixin.SshBashShell
: Simple class mixing the Bash specialized pexcept based shell with the SSHTelnetBashShell
: Simple class mixing the Bash specialized pexcept based shell with the
-
class
topology_connect.shell.
SshMixin
(*args, **kwargs)¶ SSH connection mixin for the Topology shell API.
This class implements a
_get_connect_command()
method that allows to interact with a shell through an SSH session, and extends the constructor to request for SSH related connection parameters.The default options will assume that you will be connecting using a SSH key (and you seriously SHOULD). If, for some reason, you MUST use a password to connect to the shell in question (and DON’T unless absolutely required! Like, really, really, DO NOT!) you must set the
identity_file
toNone
and set the options to at least haveBatchMode=no
. Also, as expected by the Topology shell low level API you must pass thepassword
(andpassword_match
if required) to the constructor.Note: The constructor of this class should look as follow:
# Using PEP 3102 -- Keyword-Only Arguments def __init__( self, *args, user=None, hostname='127.0.0.1', port=22, # noqa options=('BatchMode=yes', ), identity_file='id_rsa', **kwargs):
Sadly, this is Python 3 only. Python 2.7 didn’t backported this feature. So, this is the legacy way to achieve the same goal. Awful, I know :/
Parameters: - user (str) – User to connect with. If
None
, the user running the process will be used. - hostname (str) – Hostname or IP to connect to.
- port (int) – SSH port to connect to.
- options (tuple) – SSH options to use.
- identity_file (str) – Absolute or relative (in relation to
~/.ssh/
) path to the private key identity file. IfNone
is provided, key based authentication will not be used.
Inheritance
- user (str) – User to connect with. If
-
class
topology_connect.shell.
TelnetMixin
(*args, **kwargs)¶ Telnet connection mixin for the Topology shell API.
Note: The constructor of this class should look as follow:
# Using PEP 3102 -- Keyword-Only Arguments def __init__( self, *args, hostname='127.0.0.1', port=23, **kwargs):
Sadly, this is Python 3 only. Python 2.7 didn’t backported this feature. So, this is the legacy way to achieve the same goal. Awful, I know :/
Parameters: Inheritance
-
class
topology_connect.shell.
SshShell
(*args, **kwargs)¶ Simple class mixing the pexcept based shell with the SSH mixin.
Inheritance
-
class
topology_connect.shell.
TelnetShell
(*args, **kwargs)¶ Simple class mixing the pexcept based shell with the Telnet mixin.
Inheritance
-
class
topology_connect.shell.
SshBashShell
(*args, **kwargs)¶ Simple class mixing the Bash specialized pexcept based shell with the SSH mixin.
Inheritance
-
class
topology_connect.shell.
TelnetBashShell
(*args, **kwargs)¶ Simple class mixing the Bash specialized pexcept based shell with the Telnet mixin.
Inheritance
SSH/Telnet/etc connection Platform Engine for Topology¶

SSH/Telnet/etc connection Platform Engine plugin for the Network Topology Framework.
Documentation¶
Development¶
License¶
Copyright (C) 2015-2016 Hewlett Packard Enterprise Development LP
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.