Skip to content

Instantly share code, notes, and snippets.

@slankdev
Last active November 7, 2017 08:33
Show Gist options
  • Save slankdev/8839ced7f48939a195da6df5ce283647 to your computer and use it in GitHub Desktop.
Save slankdev/8839ced7f48939a195da6df5ce283647 to your computer and use it in GitHub Desktop.
ws API Doc
.out
.o
.html
#!/usr/bin/env python3
#
# MIT License
# Copyright (c) 2017 Susanow
# Copyright (c) 2017 Hiroki SHIROKURA
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Available Commands
# - show
# - show ports
# - show vnfs
# - vnf
# - vnf <name> stat
# - vnf <name> deploy <coremask>
# - vnf <name> undeploy
# - vnf <name> portattach <port-name> <id>
# - port
# - port <name> stat
import pycurl
import time
import sys
def vnf():
def vnf_NAME_stat():
def vnf_NAME_deploy_COREMASK():
def vnf_NAME_undeploy():
def vnf_NAME_portattach_PORTNAME_ID():
def port():
def port_NAME_stat():
def show_vnfs(argc, argv):
print("show vnfs")
def show_ports(argc, argv):
print("show ports")
def usage_help():
print("Usage: ssnctl show [OPTIONS]")
print(" vnfs ")
print(" ports ")
def show(argc, argv):
if (argc < 2):
usage_help()
exit(-1)
if (argv[1] == "vnfs"): show_vnfs(argc-1, argv[1:])
elif (argv[1] == "ports"): show_ports(argc-1, argv[1:])
else:
print("show: unknown option")
usage_help()
def usage():
print("Usage: ssnctl [OPTIONS]")
print("")
print(" OPTIONS")
print(" show")
print(" vnf")
print(" port")
def main():
argc = len(sys.argv)
argv = sys.argv
if (argc < 2):
usage()
exit(-1)
if (argv[1] == "show"): show(argc-1, argv[1:])
def curl_google_loop():
target = 'http://google.com'
while True:
curl = pycurl.Curl()
curl.setopt(pycurl.URL, target)
curl.perform()
print('')
time.sleep(1)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment