This repository has been archived by the owner on Dec 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from nre-learning/config-presentation
Converting existing lessons to match new endpoint format
- Loading branch information
Showing
63 changed files
with
1,582 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
napalm | ||
ansible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
docker build -t antidotelabs/jupyter . | ||
docker push antidotelabs/jupyter | ||
docker build -t antidotelabs/jupyter:newpath . | ||
docker push antidotelabs/jupyter:newpath |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
lessonName: Antidote Test Lesson | ||
lessonId: 1 | ||
category: fundamentals | ||
tier: ptr #NEVER promote to prod. Not a real lesson | ||
lessonDiagram: https://raw.githubusercontent.com/nre-learning/nrelabs-curriculum/v0.3.2/lessons/lesson-15/lessondiagram.png | ||
description: | | ||
Example lesson used to test the various features of the Antidote platform | ||
slug: selfservice | ||
tags: | ||
- foo | ||
- bar | ||
|
||
endpoints: | ||
|
||
- name: influxdb | ||
image: influxdb | ||
additionalPorts: [8086] | ||
|
||
- name: selfservice | ||
image: antidotelabs/selfservice-flask-app | ||
presentations: | ||
- name: web | ||
port: 5000 | ||
type: http | ||
|
||
- name: vqfx1 | ||
image: antidotelabs/vqfx:snap1 | ||
configurationType: python | ||
presentations: | ||
- name: cli | ||
port: 22 | ||
type: ssh | ||
|
||
- name: vqfx2 | ||
image: antidotelabs/vqfx:snap2 | ||
configurationType: napalm-junos | ||
presentations: | ||
- name: cli | ||
port: 22 | ||
type: ssh | ||
|
||
- name: vqfx3 | ||
image: antidotelabs/vqfx:snap3 | ||
configurationType: napalm-junos | ||
presentations: | ||
- name: cli | ||
port: 22 | ||
type: ssh | ||
|
||
- name: linux | ||
image: antidotelabs/utility | ||
configurationType: ansible | ||
presentations: | ||
- name: cli1 | ||
port: 22 | ||
type: ssh | ||
- name: cli2 | ||
port: 22 | ||
type: ssh | ||
|
||
connections: | ||
- a: vqfx1 | ||
b: vqfx2 | ||
- a: vqfx2 | ||
b: vqfx3 | ||
- a: vqfx3 | ||
b: vqfx1 | ||
|
||
stages: | ||
|
||
- id: 1 | ||
description: Stage 1 | ||
- id: 2 | ||
description: Stage 2 | ||
jupyterLabGuide: true |
15 changes: 15 additions & 0 deletions
15
lessons/fundamentals/lesson-1-demo/stage1/configs/linux.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
- name: test playbook | ||
hosts: all | ||
gather_facts: no | ||
vars: | ||
ansible_user: antidote | ||
ansible_password: antidotepassword | ||
tasks: | ||
|
||
- name: Debug date | ||
shell: date | ||
register: date_output | ||
|
||
- debug: | ||
msg: "{{ date_output }}" |
32 changes: 32 additions & 0 deletions
32
lessons/fundamentals/lesson-1-demo/stage1/configs/vqfx1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env python | ||
|
||
import sys, os | ||
import napalm | ||
from jinja2 import FileSystemLoader, Environment | ||
|
||
user = "antidote" | ||
password = "antidotepassword" | ||
vendor = "junos" | ||
port = "22" | ||
host = os.getenv("SYRINGE_TARGET_HOST") | ||
template_file = "vqfx1.txt" | ||
|
||
driver = napalm.get_network_driver(vendor) | ||
with driver(hostname=host, username=user, password=password, optional_args={'port': port}) as device: | ||
|
||
# Retrieve management IP address | ||
# TODO(mierdin): this is junos-specific. Will need to maintain a list of management interfaces per vendor, | ||
# or expose this as a field in the endpoint. | ||
interface_ip_details = device.get_interfaces_ip()['em0.0'] | ||
for addr, prefix in interface_ip_details['ipv4'].items(): | ||
address_cidr = "%s/%s" % (addr, prefix['prefix_length']) | ||
|
||
# Create template configuration with this address | ||
loader = FileSystemLoader([os.path.dirname(os.path.realpath(__file__))]) # Use current directory | ||
env = Environment(loader=loader, trim_blocks=True, lstrip_blocks=True) | ||
template_object = env.get_template(template_file) | ||
rendered_config = template_object.render(mgmt_addr=address_cidr) | ||
|
||
# Push rendered config to device | ||
device.load_replace_candidate(config=rendered_config) | ||
device.commit_config() |
165 changes: 165 additions & 0 deletions
165
lessons/fundamentals/lesson-1-demo/stage1/configs/vqfx1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
<configuration> | ||
<version>15.1X53-D60.4</version> | ||
<system> | ||
<host-name>vqfx1</host-name> | ||
<root-authentication> | ||
<encrypted-password>$1$mlo32jo6$BOMVhmtORai2Kr24wRCCv1</encrypted-password> | ||
<ssh-rsa> | ||
<name>ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key</name> | ||
</ssh-rsa> | ||
</root-authentication> | ||
<login> | ||
<user> | ||
<name>antidote</name> | ||
<class>super-user</class> | ||
<authentication> | ||
<encrypted-password>$1$iH4TNedH$3RKJbtDRO.N4Ua8B6LL/v/</encrypted-password> | ||
</authentication> | ||
</user> | ||
<password> | ||
<change-type>set-transitions</change-type> | ||
<minimum-changes>0</minimum-changes> | ||
</password> | ||
</login> | ||
<services> | ||
<ssh> | ||
<root-login>allow</root-login> | ||
</ssh> | ||
<netconf> | ||
<ssh> | ||
</ssh> | ||
<rfc-compliant/> | ||
</netconf> | ||
<rest> | ||
<http> | ||
<port>8080</port> | ||
</http> | ||
<enable-explorer/> | ||
</rest> | ||
</services> | ||
<syslog> | ||
<user> | ||
<name>*</name> | ||
<contents> | ||
<name>any</name> | ||
<emergency/> | ||
</contents> | ||
</user> | ||
<file> | ||
<name>messages</name> | ||
<contents> | ||
<name>any</name> | ||
<notice/> | ||
</contents> | ||
<contents> | ||
<name>authorization</name> | ||
<info/> | ||
</contents> | ||
</file> | ||
<file> | ||
<name>interactive-commands</name> | ||
<contents> | ||
<name>interactive-commands</name> | ||
<any/> | ||
</contents> | ||
</file> | ||
</syslog> | ||
<extensions> | ||
<providers> | ||
<name>juniper</name> | ||
<license-type> | ||
<name>juniper</name> | ||
<deployment-scope>commercial</deployment-scope> | ||
</license-type> | ||
</providers> | ||
<providers> | ||
<name>chef</name> | ||
<license-type> | ||
<name>juniper</name> | ||
<deployment-scope>commercial</deployment-scope> | ||
</license-type> | ||
</providers> | ||
</extensions> | ||
</system> | ||
<interfaces> | ||
<interface> | ||
<name>em0</name> | ||
<unit> | ||
<name>0</name> | ||
<family> | ||
<inet> | ||
<address> | ||
<name>{{ mgmt_addr }}</name> | ||
</address> | ||
</inet> | ||
</family> | ||
</unit> | ||
</interface> | ||
<interface> | ||
<name>em3</name> | ||
<unit> | ||
<name>0</name> | ||
<family> | ||
<inet> | ||
<address> | ||
<name>10.12.0.11/24</name> | ||
</address> | ||
</inet> | ||
</family> | ||
</unit> | ||
</interface> | ||
<interface> | ||
<name>em4</name> | ||
<unit> | ||
<name>0</name> | ||
<family> | ||
<inet> | ||
<address> | ||
<name>10.31.0.11/24</name> | ||
</address> | ||
</inet> | ||
</family> | ||
</unit> | ||
</interface> | ||
</interfaces> | ||
<forwarding-options> | ||
<storm-control-profiles> | ||
<name>default</name> | ||
<all> | ||
</all> | ||
</storm-control-profiles> | ||
</forwarding-options> | ||
<routing-options> | ||
<autonomous-system> | ||
<as-number>64001</as-number> | ||
</autonomous-system> | ||
</routing-options> | ||
<protocols> | ||
<bgp operation="replace"> | ||
<group> | ||
<name>PEERS</name> | ||
<type>external</type> | ||
<neighbor> | ||
<name>10.31.0.13</name> | ||
<peer-as>64003</peer-as> | ||
</neighbor> | ||
<neighbor> | ||
<name>10.12.0.12</name> | ||
<peer-as>64002</peer-as> | ||
</neighbor> | ||
</group> | ||
</bgp> | ||
<igmp-snooping> | ||
<vlan> | ||
<name>default</name> | ||
</vlan> | ||
</igmp-snooping> | ||
|
||
</protocols> | ||
<vlans> | ||
<vlan> | ||
<name>default</name> | ||
<vlan-id>1</vlan-id> | ||
</vlan> | ||
</vlans> | ||
</configuration> |
Oops, something went wrong.