From 0fe8943a48de12f89186803d5fde1b761ba5902a Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Thu, 1 Feb 2018 13:56:53 -0500 Subject: [PATCH 01/20] WIP: DOCS MATTER! --- docs/INSTALL.rst | 84 ++++++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst index 0eb65c04..919ff6a8 100644 --- a/docs/INSTALL.rst +++ b/docs/INSTALL.rst @@ -16,11 +16,11 @@ Prerequisite Software HIL requires a number of packages available through the CentOS RPM repositories, as well as the EPEL repository. EPEL can be enabled via:: - yum install epel-release + $ yum install epel-release Then, the rest of the packages can be installed via:: - yum install libvirt bridge-utils ipmitool telnet httpd mod_wsgi python-pip qemu-kvm python-virtinst virt-install python-psycopg2 vconfig net-tools + $ yum install libvirt bridge-utils ipmitool telnet httpd mod_wsgi python-pip qemu-kvm python-virtinst virt-install python-psycopg2 vconfig net-tools In addition, HIL depends on a number of python libraries. Many of these are available as RPMs as well, but we recommend installing them with pip, since @@ -35,7 +35,7 @@ The setup described in this document runs into problems with SELinux. In the future, we hope to ship a set of SELinux security policies with HIL, but for now the solution is to disable SELinux:: - sudo setenforce 0 + $ sudo setenforce 0 Make sure SELinux is also disabled on startup. To do this `on CentOS/RHEL `_, edit @@ -70,7 +70,7 @@ Copy the following lines in file ``hil_env`` Before starting this procedure do:: - source hil_env + $ source hil_env Setting up system user for HIL: @@ -78,16 +78,16 @@ Setting up system user for HIL: First create a system user ``${HIL_USER}`` with:: - sudo useradd --system ${HIL_USER} -d /var/lib/hil -m -r + $ sudo useradd --system ${HIL_USER} -d /var/lib/hil -m -r The HIL software itself can then be installed as root by running:: - sudo su - - cd /root - git clone https://github.com/CCI-MOC/hil - cd hil - sudo python setup.py install + $ sudo su - + $ cd /root + $ git clone https://github.com/CCI-MOC/hil + $ cd hil + $ sudo python setup.py install hil.cfg @@ -115,12 +115,12 @@ permissions should be set to read-only and ownership set to ``${HIL_USER}`` From source directory of hil as user root do the following:: (from /root/hil) - cp examples/hil.cfg /etc/hil.cfg - chown ${HIL_USER}:${HIL_USER} hil.cfg - chmod 400 hil.cfg + $ cp examples/hil.cfg /etc/hil.cfg + $ chown ${HIL_USER}:${HIL_USER} hil.cfg + $ chmod 400 hil.cfg (run following command as ${HIL_USER} from ${HIL_HOME_DIR} - su - ${HIL_USER} - ln -s /etc/hil.cfg . + $ su - ${HIL_USER} + $ ln -s /etc/hil.cfg . Authentication and Authorization -------------------------------- @@ -175,14 +175,14 @@ provides one way to accomplish this. To create the database tables, first make sure ``hil.cfg`` is set up the way you need, including any extensions you plan to use, then:: - sudo -i -u ${HIL_USER}; hil-admin db create + $ sudo -i -u ${HIL_USER}; hil-admin db create If the authorization backend activated in ``hil.cfg`` is ``hil.ext.auth.database =`` then you will need to add an initial user with administrative privileges to the database in order to bootstrap the system. You can do this by running the following command (as user ``hil``):: - sudo -i -u ${HIL_USER}; hil create_admin_user ${HIL_ADMIN_USER} ${HIL_ADMIN_PASSWORD} + $ sudo -i -u ${HIL_USER}; hil create_admin_user ${HIL_ADMIN_USER} ${HIL_ADMIN_PASSWORD} You can then create additional users via the HTTP API. You may want to subsequently delete the initial user; this can also be done via the API. @@ -191,7 +191,7 @@ subsequently delete the initial user; this can also be done via the API. All HIL commands in these instructions should be run in this directory:: - cd /var/lib/hil + $ cd /var/lib/hil Networking - Bridges -------------------- @@ -241,21 +241,21 @@ Starting the service: ^^^^^^^^^^^^^^^^^^^^^ Following commands will start the daemon: -``systemctl daemon-reload`` -``systemctl start create_bridges.service`` +``$ systemctl daemon-reload`` +``$ systemctl start create_bridges.service`` You can check the status using: -``systemctl status create_bridges.service`` +``$ systemctl status create_bridges.service`` To auto-start the service on boot (recommended): -``systemctl enable create_bridges.service`` +``$ systemctl enable create_bridges.service`` For systems that do not support systemd: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You can add the following line:: - (cd /etc && create_bridges) + ($ cd /etc && create_bridges) to the end of ``/etc/rc.local``. @@ -280,16 +280,16 @@ uncomment the following lines:: Then create the group 'libvirt' and add the HIL user to that group:: - sudo groupadd libvirt - sudo gpasswd libvirt -a hil + $ sudo groupadd libvirt + $ sudo gpasswd libvirt -a hil Finally, restart ``libvirt`` with:: - sudo service libvirtd restart + $ sudo service libvirtd restart You should also set libvirt to start on boot:: - sudo chkconfig libvirtd on + $ sudo chkconfig libvirtd on Headnode image ^^^^^^^^^^^^^^ @@ -312,8 +312,8 @@ The directory specified by path must already exist, and be readable and writable by the ``libvirt`` user. Then activate the pool, and make the it activate on boot, with:: - virsh --connect qemu:///system pool-start hil_headnodes - virsh --connect qemu:///system pool-autostart hil_headnodes + $ virsh --connect qemu:///system pool-start hil_headnodes + $ virsh --connect qemu:///system pool-autostart hil_headnodes The scripts in ``examples/cloud-img-with-passwd`` can be used to build an ubuntu 14.04 or centos 7 disk image with a default root password. Read @@ -322,11 +322,11 @@ the README in that directory for more information. Once the disk image is built, copy ito the storage pool directory (here we assume it is called ``base.img``):: - mv base.img /var/lib/libvirt/images/ + $ mv base.img /var/lib/libvirt/images/ Finally, create the base headnode with:: - virsh --connect qemu:///system define base.xml + $ virsh --connect qemu:///system define base.xml where ``base.xml`` contains a description of the headnode:: @@ -423,18 +423,18 @@ following directive will have to be turned on If you haven't already, create the directory that will contain the HIL WSGI module:: - sudo mkdir /var/www/hil/ + $ sudo mkdir /var/www/hil/ Copy the file ``hil.wsgi`` from the top of the hil source tree to the location indicated by the ``WSGIScriptAlias`` option. The virtual host and server name should be set according to the hostname (and port) by which clients will access the api. Then, restart Apache:: - sudo service httpd restart + $ sudo service httpd restart You should also set apache to start on boot:: - sudo chkconfig httpd on + $ sudo chkconfig httpd on Running the network server: --------------------------- @@ -465,14 +465,14 @@ Starting the service: --------------------- Following commands will start the daemon: -``systemctl daemon-reload`` -``systemctl start hil_network`` +``$ systemctl daemon-reload`` +``$ systemctl start hil_network`` You can check the status using: -``systemctl status hil_network`` +``$ systemctl status hil_network`` To auto-start the service on boot: -``systemctl enable hil_network`` +``$ systemctl enable hil_network`` For systems that do not support systemd: @@ -482,11 +482,11 @@ It uses "Upstart" an equivalent of systemd to manage its daemons/processes. For such systems, the networking server may be started as the HIL user by running:: - hil serve_networks & + $ hil serve_networks & To make this happen on boot, add the following to ``/etc/rc.local``:: - (cd /var/lib/hil && su hil -c 'hil serve_networks') & + ($ cd /var/lib/hil && su hil -c 'hil serve_networks') & HIL Client: @@ -506,8 +506,8 @@ Create a file ``client_env`` with following entries:: To get started with HIL from your home dir do the following:: - source client_env - hil list_nodes all + $ source client_env + $ hil list_nodes all If you get an empty list ``[]`` as output then congratulations !! At this point, you should have a functional HIL service running! From b42879bb90e4084f7605b3dd609d126339c43dcf Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Thu, 1 Feb 2018 14:14:43 -0500 Subject: [PATCH 02/20] add README to hil client api --- hil/client/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 hil/client/README.md diff --git a/hil/client/README.md b/hil/client/README.md new file mode 100644 index 00000000..86b79a33 --- /dev/null +++ b/hil/client/README.md @@ -0,0 +1,17 @@ +### HIL Python Client API +#### How to get started? +``` +import requests +import os +from hil.client.client import Client, RequestsHTTPClient + +ep = os.environ.get('HIL_ENDPOINT') +basic_username = os.getenv('HIL_USERNAME') +basic_password = os.getenv('HIL_PASSWORD') + +http_client = RequestsHTTPClient() +http_client.auth = (basic_username, basic_password) +C = Client(ep, http_client) +print C.project.create("test-project") + +``` From 71b67348fc808432d4b85aee704ed3cc40f5c4e7 Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Thu, 1 Feb 2018 14:28:15 -0500 Subject: [PATCH 03/20] change the readme in /client --- hil/client/README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hil/client/README.md b/hil/client/README.md index 86b79a33..d7a41675 100644 --- a/hil/client/README.md +++ b/hil/client/README.md @@ -1,7 +1,11 @@ ### HIL Python Client API -#### How to get started? +#### How to Install HIL Modules? +``` +pip install git+https://github.com/cci-moc/hil +``` + +#### How to Get Started? ``` -import requests import os from hil.client.client import Client, RequestsHTTPClient @@ -15,3 +19,6 @@ C = Client(ep, http_client) print C.project.create("test-project") ``` + +#### More Examples. +[leasing script](https://github.com/CCI-MOC/hil/blob/master/examples/leasing/node_release_script.py) From d47f8ccda37bd106630268d5bc601af73a8b0ead Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Thu, 1 Feb 2018 17:05:28 -0500 Subject: [PATCH 04/20] add more examples in the cli docs --- docs/USING.rst | 59 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/docs/USING.rst b/docs/USING.rst index 487a996a..372e0615 100644 --- a/docs/USING.rst +++ b/docs/USING.rst @@ -94,7 +94,7 @@ cli call :: - hil switch_register mockswitch02 mock switchhost01 switchuser01 password1234 + $ hil switch_register mockswitch02 mock switchhost01 switchuser01 password1234 2) Registering a Node which uses IPMI for out of band management ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -111,19 +111,62 @@ For nodes using IPMI use the following api call: :: - curl -X PUT http://127.0.0.1:5001/node/dummyNode01 -d ' - > {"obm": { "type": "http://schema.massopencloud.org/haas/v0/obm/ipmi", - > "host": "ipmiHost4node-01", - > "user": "ipmiUser4node-01", - > "password": "ipmiPass4node-01" - > }}' + curl -X PUT http://127.0.0.1:5001/node/dummyNode01 -d ' + > {"obm": { "type": "http://schema.massopencloud.org/haas/v0/obm/ipmi", + > "host": "ipmiHost4node-01", + > "user": "ipmiUser4node-01", + > "password": "ipmiPass4node-01" + > }}' Corresponding cli calls will be as follows: :: - hil node_register ipmi dummyNode01 ipmiHost4node-01 ipmiUser4node-01 ipmiPass4node-01 + $ hil node_register ipmi dummyNode01 ipmiHost4node-01 ipmiUser4node-01 ipmiPass4node-01 + +3) Creating a Project in HIL +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +Eg> Project name mockproject01 + +api call + +:: + + curl -X put http://127.0.0.1:5000/project/mockproject01 + +cli call + +:: + + $ hil project_create mockproject01 + +4) Register a node in HIL +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +Eg> Node name mocknode01 + Node type: mock + Host name: mockhost01 + User name: nodeuser01 + Password: password1234 + +api call + +:: + + curl -X put http://127.0.0.1:5000/node/mocknode01 -d ' + > {"type": "http://schema.massopencloud.org/haas/v0/nodes/mock", + > "hostname": "mockhost01", + > "username": "nodeuser01", + > "password": "password1234"}' + +cli call + +:: + $ hil node_register mocknode01 mock mockhost01 nodeuser01 password1234 From d3200949ec19c8cb6a72318613010c895102b79d Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Thu, 1 Feb 2018 20:21:23 -0500 Subject: [PATCH 05/20] fix ident --- docs/USING.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/USING.rst b/docs/USING.rst index 372e0615..36d68a09 100644 --- a/docs/USING.rst +++ b/docs/USING.rst @@ -130,9 +130,10 @@ Corresponding cli calls will be as follows: Eg> Project name mockproject01 - + api call + :: curl -X put http://127.0.0.1:5000/project/mockproject01 @@ -141,6 +142,7 @@ cli call :: + $ hil project_create mockproject01 4) Register a node in HIL @@ -149,14 +151,16 @@ cli call Eg> Node name mocknode01 Node type: mock - Host name: mockhost01 + Host name: mockhost01 User name: nodeuser01 Password: password1234 api call + :: + curl -X put http://127.0.0.1:5000/node/mocknode01 -d ' > {"type": "http://schema.massopencloud.org/haas/v0/nodes/mock", > "hostname": "mockhost01", @@ -165,8 +169,9 @@ api call cli call + :: - $ hil node_register mocknode01 mock mockhost01 nodeuser01 password1234 + $ hil node_register mocknode01 mock mockhost01 nodeuser01 password1234 From 3ba49966d1281388b9f212d2f7a292a6db26b801 Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Thu, 1 Feb 2018 21:25:53 -0500 Subject: [PATCH 06/20] fix space --- docs/USING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/USING.rst b/docs/USING.rst index 36d68a09..8a16f171 100644 --- a/docs/USING.rst +++ b/docs/USING.rst @@ -165,7 +165,7 @@ api call > {"type": "http://schema.massopencloud.org/haas/v0/nodes/mock", > "hostname": "mockhost01", > "username": "nodeuser01", - > "password": "password1234"}' + > "password": "password1234"}' cli call From afed5b2fb6f55f2d6368e4929dd7d7c9f3e5018f Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Fri, 2 Feb 2018 11:28:54 -0500 Subject: [PATCH 07/20] Try to cover everyone --- AUTHORS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/AUTHORS b/AUTHORS index b743346d..1c58cf79 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,11 +1,18 @@ Abishek Raju +Amin Mosayyebzadeh Andrew Mohn George Silvis, III +Ian Ballou ianballou67@gmail.com Ian Denhardt Igibek Koishybayev Jay Hennessey +(Jethro) Shuwen Sun Jonathan Bell +Kristi Nikolla +Kyle Hogan Logan Bernard +Lucas Xu +Naved Ansari Orran Krieger Peter Desnoyers Ritesh Singh From 39f630cc1d08e114cf557a83ac9f7ed90adfc3ee Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Fri, 2 Feb 2018 11:40:54 -0500 Subject: [PATCH 08/20] add create a network example --- docs/USING.rst | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/USING.rst b/docs/USING.rst index 8a16f171..66f56e9a 100644 --- a/docs/USING.rst +++ b/docs/USING.rst @@ -149,7 +149,7 @@ cli call ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Eg> Node name mocknode01 +Eg> Node name: mocknode01 Node type: mock Host name: mockhost01 User name: nodeuser01 @@ -174,4 +174,31 @@ cli call $ hil node_register mocknode01 mock mockhost01 nodeuser01 password1234 +4) Creating a Network in HIL +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +Eg> Network name: mocknetwork01 + owner: admin + access: mockproject + net_id: 101 + +api call + + +:: + + + curl -X put http://127.0.0.1:5000/network/mocknetwork01 -d ' + {"owner": "admin", + "access": "mockproject", + "net_id": "101"}' + +cli call + + +:: + + + $ hil network_create mocnetwork01 admin mockproject 101 From 62b5246436c4f5a539c3efd30892966bb6ab044c Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Mon, 5 Feb 2018 19:11:38 +0000 Subject: [PATCH 09/20] trailing space --- docs/USING.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/USING.rst b/docs/USING.rst index 66f56e9a..594dc7f3 100644 --- a/docs/USING.rst +++ b/docs/USING.rst @@ -134,7 +134,7 @@ Eg> Project name mockproject01 api call -:: +:: curl -X put http://127.0.0.1:5000/project/mockproject01 From b7a0acdf89d7a7e918703e8a3b744dd422d0a32c Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Tue, 6 Feb 2018 15:59:30 +0000 Subject: [PATCH 10/20] a few changes --- docs/INSTALL.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst index 919ff6a8..6b3a65ab 100644 --- a/docs/INSTALL.rst +++ b/docs/INSTALL.rst @@ -48,23 +48,23 @@ to SELINUX=permissive ``` -User need to choose appropriate values for their environment: +User needs to choose appropriate values for their environment: ------------------------------------------------------------- For simplicity we have provided default values: Copy the following lines in file ``hil_env`` - HIL_USER=hil + export HIL_USER=hil - HIL_DB_ROLE=hil + export HIL_DB_ROLE=hil - HIL_DB_PASSWORD=secret + export HIL_DB_PASSWORD=secret - HIL_ADMIN=hil + export HIL_ADMIN=hil - HIL_ADMIN_PASSWORD=secret + export HIL_ADMIN_PASSWORD=secret - HIL_HOME_DIR=/var/lib/hil + export HIL_HOME_DIR=/var/lib/hil @@ -87,7 +87,7 @@ The HIL software itself can then be installed as root by running:: $ cd /root $ git clone https://github.com/CCI-MOC/hil $ cd hil - $ sudo python setup.py install + $ python setup.py install hil.cfg From 9be25107cabb14c1a1ad1fd1cbb094f6c7bf7a26 Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Tue, 6 Feb 2018 16:33:42 +0000 Subject: [PATCH 11/20] cleanup unused vars --- docs/INSTALL.rst | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst index 6b3a65ab..137ac2a2 100644 --- a/docs/INSTALL.rst +++ b/docs/INSTALL.rst @@ -56,10 +56,6 @@ Copy the following lines in file ``hil_env`` export HIL_USER=hil - export HIL_DB_ROLE=hil - - export HIL_DB_PASSWORD=secret - export HIL_ADMIN=hil export HIL_ADMIN_PASSWORD=secret From 8db62da7003586aa3e86f6a0643d5984cdae2515 Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Tue, 6 Feb 2018 15:20:46 -0500 Subject: [PATCH 12/20] Update AUTHORS --- AUTHORS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 1c58cf79..7c86e466 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,7 +2,7 @@ Abishek Raju Amin Mosayyebzadeh Andrew Mohn George Silvis, III -Ian Ballou ianballou67@gmail.com +Ian Ballou Ian Denhardt Igibek Koishybayev Jay Hennessey @@ -12,7 +12,7 @@ Kristi Nikolla Kyle Hogan Logan Bernard Lucas Xu -Naved Ansari +Naved Ansari Orran Krieger Peter Desnoyers Ritesh Singh From 8742d15dddbdbdb5e4804579aed205ff63150a88 Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Wed, 7 Feb 2018 19:43:29 +0000 Subject: [PATCH 13/20] change the format --- docs/USING.rst | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/docs/USING.rst b/docs/USING.rst index 594dc7f3..1bf412e6 100644 --- a/docs/USING.rst +++ b/docs/USING.rst @@ -75,10 +75,11 @@ Included herewith are some examples about 1) Register a switch with HIL: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Eg> Switch name: mockswitch01 - Host name: switchhost01 - User name: switchuser01 - Password: password1234 + - **Switch name:** mockswitch01 + - **Switch type:** mock + - **Host name:** switchhost01 + - **User name:** switchuser01 + - **Password:** password1234 api call @@ -108,7 +109,6 @@ cli call For nodes using IPMI use the following api call: - :: curl -X PUT http://127.0.0.1:5001/node/dummyNode01 -d ' @@ -120,7 +120,6 @@ For nodes using IPMI use the following api call: Corresponding cli calls will be as follows: - :: $ hil node_register ipmi dummyNode01 ipmiHost4node-01 ipmiUser4node-01 ipmiPass4node-01 @@ -129,11 +128,10 @@ Corresponding cli calls will be as follows: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Eg> Project name mockproject01 + - **Project name:** mockproject01 api call - :: curl -X put http://127.0.0.1:5000/project/mockproject01 @@ -142,25 +140,22 @@ cli call :: - $ hil project_create mockproject01 4) Register a node in HIL ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Eg> Node name: mocknode01 - Node type: mock - Host name: mockhost01 - User name: nodeuser01 - Password: password1234 + - **Node name:** mocknode01 + - **Node type:** mock + - **Host name:** mockhost01 + - **User name:** nodeuser01 + - **Password:** password1234 api call - :: - curl -X put http://127.0.0.1:5000/node/mocknode01 -d ' > {"type": "http://schema.massopencloud.org/haas/v0/nodes/mock", > "hostname": "mockhost01", @@ -169,7 +164,6 @@ api call cli call - :: $ hil node_register mocknode01 mock mockhost01 nodeuser01 password1234 @@ -178,17 +172,15 @@ cli call ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Eg> Network name: mocknetwork01 - owner: admin - access: mockproject - net_id: 101 + - **Network name:** mocknetwork01 + - **owner:** admin + - **access:** mockproject + - **net_id:** 101 api call - :: - curl -X put http://127.0.0.1:5000/network/mocknetwork01 -d ' {"owner": "admin", "access": "mockproject", @@ -196,9 +188,7 @@ api call cli call - :: - $ hil network_create mocnetwork01 admin mockproject 101 From 3f817135c223db579b30e62a5eb90d49e4d70403 Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Wed, 7 Feb 2018 19:46:35 +0000 Subject: [PATCH 14/20] moving client library docs to /docs --- hil/client/README.md | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 hil/client/README.md diff --git a/hil/client/README.md b/hil/client/README.md deleted file mode 100644 index d7a41675..00000000 --- a/hil/client/README.md +++ /dev/null @@ -1,24 +0,0 @@ -### HIL Python Client API -#### How to Install HIL Modules? -``` -pip install git+https://github.com/cci-moc/hil -``` - -#### How to Get Started? -``` -import os -from hil.client.client import Client, RequestsHTTPClient - -ep = os.environ.get('HIL_ENDPOINT') -basic_username = os.getenv('HIL_USERNAME') -basic_password = os.getenv('HIL_PASSWORD') - -http_client = RequestsHTTPClient() -http_client.auth = (basic_username, basic_password) -C = Client(ep, http_client) -print C.project.create("test-project") - -``` - -#### More Examples. -[leasing script](https://github.com/CCI-MOC/hil/blob/master/examples/leasing/node_release_script.py) From 57232e55f6c3b53bbd655c5a961c22e990f5603e Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Wed, 7 Feb 2018 19:47:23 +0000 Subject: [PATCH 15/20] add client library md --- docs/client-library.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 docs/client-library.md diff --git a/docs/client-library.md b/docs/client-library.md new file mode 100644 index 00000000..28ebf526 --- /dev/null +++ b/docs/client-library.md @@ -0,0 +1,25 @@ +# HIL Client Library + +## How to Install HIL Modules? +``` +pip install git+https://github.com/cci-moc/hil +``` + +## How to Get Started? +``` +import os +from hil.client.client import Client, RequestsHTTPClient + +ep = os.environ.get('HIL_ENDPOINT') +basic_username = os.getenv('HIL_USERNAME') +basic_password = os.getenv('HIL_PASSWORD') + +http_client = RequestsHTTPClient() +http_client.auth = (basic_username, basic_password) +C = Client(ep, http_client) +print C.project.create("test-project") + +``` + +## More Examples. +[leasing script](https://github.com/CCI-MOC/hil/blob/master/examples/leasing/node_release_script.py) From 4af5a6134fdd6d21cdb6877b904b895729a4c93f Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Thu, 8 Feb 2018 16:12:19 +0000 Subject: [PATCH 16/20] add description for Client Library --- docs/client-library.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/client-library.md b/docs/client-library.md index 28ebf526..5c3f01e9 100644 --- a/docs/client-library.md +++ b/docs/client-library.md @@ -1,5 +1,8 @@ # HIL Client Library +##Description +The HIL API Client Library for Python is designed for Python client-application developers. It offers simple access to HIL APIs. + ## How to Install HIL Modules? ``` pip install git+https://github.com/cci-moc/hil From ddf555d3c21c51dec54ba5985870d67011c319bc Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Thu, 8 Feb 2018 13:51:50 -0500 Subject: [PATCH 17/20] Update client-library.md --- docs/client-library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/client-library.md b/docs/client-library.md index 5c3f01e9..d4c73ea2 100644 --- a/docs/client-library.md +++ b/docs/client-library.md @@ -1,6 +1,6 @@ # HIL Client Library -##Description +## Description The HIL API Client Library for Python is designed for Python client-application developers. It offers simple access to HIL APIs. ## How to Install HIL Modules? From 18be77450f7dd9c165e642ea8cdd061194750031 Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Thu, 8 Feb 2018 13:53:53 -0500 Subject: [PATCH 18/20] Update client-library.md --- docs/client-library.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/client-library.md b/docs/client-library.md index d4c73ea2..0aae87de 100644 --- a/docs/client-library.md +++ b/docs/client-library.md @@ -5,7 +5,7 @@ The HIL API Client Library for Python is designed for Python client-application ## How to Install HIL Modules? ``` -pip install git+https://github.com/cci-moc/hil +$ pip install git+https://github.com/cci-moc/hil ``` ## How to Get Started? From 955f144f85c64dd76d9cf6fe32f9ea343b4d90ce Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Wed, 14 Feb 2018 10:37:32 -0500 Subject: [PATCH 19/20] Update USING.rst --- docs/USING.rst | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/docs/USING.rst b/docs/USING.rst index 1bf412e6..7c051e3b 100644 --- a/docs/USING.rst +++ b/docs/USING.rst @@ -75,11 +75,11 @@ Included herewith are some examples about 1) Register a switch with HIL: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - **Switch name:** mockswitch01 - - **Switch type:** mock - - **Host name:** switchhost01 - - **User name:** switchuser01 - - **Password:** password1234 +- **Switch name:** mockswitch01 +- **Switch type:** mock +- **Host name:** switchhost01 +- **User name:** switchuser01 +- **Password:** password1234 api call @@ -101,11 +101,11 @@ cli call ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - **Node name:** dummyNoderHIL-02 - - **Ipmi info:** - + **hostname:** ipmiHost4node-02 - + **ipmi_username:** ipmiUser4node-02 - + **ipmi_password:** ipmiPass4node-02 +- **Node name:** dummyNoderHIL-02 +- **Ipmi info:** + + **hostname:** ipmiHost4node-02 + + **ipmi_username:** ipmiUser4node-02 + + **ipmi_password:** ipmiPass4node-02 For nodes using IPMI use the following api call: @@ -128,7 +128,7 @@ Corresponding cli calls will be as follows: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - **Project name:** mockproject01 +- **Project name:** mockproject01 api call @@ -146,11 +146,11 @@ cli call ^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - **Node name:** mocknode01 - - **Node type:** mock - - **Host name:** mockhost01 - - **User name:** nodeuser01 - - **Password:** password1234 +- **Node name:** mocknode01 +- **Node type:** mock +- **Host name:** mockhost01 +- **User name:** nodeuser01 +- **Password:** password1234 api call @@ -172,10 +172,10 @@ cli call ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - - **Network name:** mocknetwork01 - - **owner:** admin - - **access:** mockproject - - **net_id:** 101 +- **Network name:** mocknetwork01 +- **owner:** admin +- **access:** mockproject +- **net_id:** 101 api call From 55e673001e686bf64de6a38003d529a20ca893b1 Mon Sep 17 00:00:00 2001 From: "Lucas H. Xu" Date: Wed, 14 Feb 2018 10:40:47 -0500 Subject: [PATCH 20/20] Update USING.rst --- docs/USING.rst | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/docs/USING.rst b/docs/USING.rst index 7c051e3b..c679686d 100644 --- a/docs/USING.rst +++ b/docs/USING.rst @@ -60,16 +60,11 @@ been run succesfully. Usage examples --------------- -Included herewith are some examples about +Included here with are some examples about - * Interacting with HIL API directly using the curl utility. - - * And using equivalent cli calls are also included. - -:: - - hil node_register ipmi dummyNode01 ipmiHost4node-01 ipmiUser4node-01 ipmiPass4node-01 +* Interacting with HIL API directly using the curl utility. +* And using equivalent cli calls are also included. 1) Register a switch with HIL: @@ -191,4 +186,3 @@ cli call :: $ hil network_create mocnetwork01 admin mockproject 101 -