diff options
author | Jonas Lindstad <jonaslindstad@gmail.com> | 2015-02-13 01:17:33 +0100 |
---|---|---|
committer | Jonas Lindstad <jonaslindstad@gmail.com> | 2015-02-13 01:17:33 +0100 |
commit | da36bc985c3e799dae68cdede01f9f985f7444c8 (patch) | |
tree | e064880069e4112b8f31aad1017992eed80c7e6b | |
parent | 747766c4e125e0107aac8b075a71e361f48a2130 (diff) |
Minor updates, documentation and fixes
-rw-r--r-- | junos-bootstrap/database/README.md | 41 | ||||
-rw-r--r-- | junos-bootstrap/dhcpd/DHCP_protocol_breakdown.txt | 18 | ||||
-rw-r--r-- | junos-bootstrap/httpd/server_http.py | 7 |
3 files changed, 62 insertions, 4 deletions
diff --git a/junos-bootstrap/database/README.md b/junos-bootstrap/database/README.md index e63a317..5925fdb 100644 --- a/junos-bootstrap/database/README.md +++ b/junos-bootstrap/database/README.md @@ -2,6 +2,7 @@ PostgreSQL +**Tables** ``` bootstrap-> \dt List of relations @@ -11,6 +12,7 @@ bootstrap-> \dt ``` +**Table structure** ``` bootstrap=> \d switches Table "public.switches" @@ -31,7 +33,44 @@ Indexes: "switches_pkey" PRIMARY KEY, btree (id) ``` -## Detailed description of table fields: + +**Sample content in DB** +``` +bootstrap=> select * from switches; + id | hostname | distro_name | distro_phy_port | mgmt_addr | mgmt_cidr | mgmt_gw | mgmt_vlan | last_config_fetch | current_mac | model +----+-------------+-----------------+-----------------+------------+-----------+------------+-----------+-------------------+-------------+------- + 1 | e-00-0-test | distro-test | ge-0/0/0 | 10.0.200.2 | 24 | 10.0.200.1 | 300 | | | + 2 | e-00-1-test | distro-test | ge-0/0/3 | 10.0.200.3 | 24 | 10.0.200.1 | 300 | | | + 3 | e-00-2-test | distro-test | ge-0/0/6 | 10.0.200.4 | 24 | 10.0.200.1 | 300 | | | + 4 | e-60-0-test | distro-test | ge-0/0/9 | 10.0.200.5 | 24 | 10.0.200.1 | 300 | | | + 5 | e-01-1 | distro-test-new | ge-0/0/0 | 10.0.0.31 | 24 | 10.0.0.1 | 300 | | | + 6 | e-01-2 | distro-test-new | ge-0/0/3 | 10.0.0.32 | 24 | 10.0.0.1 | 300 | | | +(6 rows) +``` + + +**Connect to DB from CLI** +``` +j@lappie:~/git/tgmanage$ psql -U bootstrap -d bootstrap -W +Password for user bootstrap: +psql (9.3.5) +Type "help" for help. + +bootstrap=> +``` + + +**Sample procedure to insert content to DB** +``` +bootstrap=> insert into switches (hostname, distro_name, distro_phy_port, mgmt_addr, mgmt_cidr, mgmt_gw, mgmt_vlan) values +bootstrap-> ('e-01-1', 'distro-test-new', 'ge-0/0/0', '10.0.0.31', '24', '10.0.0.1', '300'), +bootstrap-> ('e-01-2', 'distro-test-new', 'ge-0/0/3', '10.0.0.32', '24', '10.0.0.1', '300'); +INSERT 0 2 +``` + + + +## Detailed description of table "switches" fields: * id: autoincreasing integer used to identify the database row * hostname: the unique edge switchs hostname - example: edge01 * distro_name: the distro switch hostname - example: distro01 diff --git a/junos-bootstrap/dhcpd/DHCP_protocol_breakdown.txt b/junos-bootstrap/dhcpd/DHCP_protocol_breakdown.txt new file mode 100644 index 0000000..5af2bf2 --- /dev/null +++ b/junos-bootstrap/dhcpd/DHCP_protocol_breakdown.txt @@ -0,0 +1,18 @@ +Length of DHCP fields in octets, and their placement in packet. +Ref: http://4.bp.blogspot.com/-IyYoFjAC4l8/UXuo16a3sII/AAAAAAAAAXQ/b6BojbYXoXg/s1600/DHCPTitle.JPG +0 OP - 1 +1 HTYPE - 1 +2 HLEN - 1 +3 HOPS - 1 +4 XID - 4 +5 SECS - 2 +6 FLAGS - 2 +7 CIADDR - 4 +8 YIADDR - 4 +9 SIADDR - 4 +10 GIADDR - 4 +11 CHADDR - 6 +12 MAGIC COOKIE - 10 +13 PADDING - 192 octets of 0's +14 MAGIC COOKIE - 4 +15 OPTIONS - variable length diff --git a/junos-bootstrap/httpd/server_http.py b/junos-bootstrap/httpd/server_http.py index a7c63d1..44f0237 100644 --- a/junos-bootstrap/httpd/server_http.py +++ b/junos-bootstrap/httpd/server_http.py @@ -22,8 +22,9 @@ def main(): ), http = dict( # host = 'localhost', - host = '10.0.30.131', - port = 8080 + # host = '10.0.30.131', + host = '10.0.100.2', + port = 80 ) ) @@ -121,7 +122,7 @@ def main(): else: print('[%s] --> File request rejected due to nonexisting file' % self.client_address[0]) else: - print('[%s] --> rejected due to bad path' % self.client_address[0]) + print('[%s] --> rejected due to bad URI' % self.client_address[0]) # silence stderr from BaseHTTPRequestHandler # source: http://stackoverflow.com/questions/3389305/how-to-silent-quiet-httpserver-and-basichttprequesthandlers-stderr-output def log_message(self, format, *args): |