├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── NOTICE
├── course.png
├── demo.gif
├── readme.md
├── requirements.txt
└── src
├── aci
└── aci-get-tenants.py
├── ansible
├── ansible.cfg
├── checklocalinfo.yml
├── hosts
├── servers
└── writefile.yml
├── coding-basics
├── circleClass.py
├── data_structures.py
├── devfun.py
├── feedme.py
├── hands_on_lab.py
├── looping.py
├── random_quote.py
├── slide.py
├── structure.py
└── variable_scope.py
├── deployment
└── testscript.sh
├── dna-center
├── dna-center-authenticate.py
├── get_client_health.py
├── get_network_devices.py
└── get_network_devices_list.py
├── meraki
├── devices-list.py
├── merakiapis.py
├── networks-list.py
├── networks-loop.py
├── organization-list.py
├── organization-loop.py
├── pagination-next.py
├── pagination.py
└── serial-list.py
├── nso
├── get-devices.py
├── get-services.py
└── loopbackdevnet.py
├── parsing
├── myfile.json
├── myfile.xml
├── myfile.yaml
├── parsejson.py
├── parsexml.py
└── parseyaml.py
├── sample-app
├── sample-app.sh
├── sample_app.py
├── static
│ └── style.css
└── templates
│ └── index.html
├── sd-wan
└── sd-wan-get-devices.py
├── security
└── password-evolution.py
├── unittest
├── best_json_search.py
├── improved_json_search.py
├── recursive_json_search.py
├── test_best_json_search.py
├── test_data.py
├── test_improved_json_search.py
└── test_json_search.py
└── webex-teams
├── authentication.py
├── create-markdown-message.py
├── create-membership.py
├── create-rooms.py
├── get-room-details.py
├── list-memberships.py
├── list-people.py
├── list-rooms.py
├── pagination-next.py
└── pagination.py
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | __pycache__
3 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at devnet-github-owners@cisco.com. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Guidance on how to contribute
2 |
3 | Contributions to this code are welcome and appreciated.
4 | Please adhere to our [Code of Conduct](./CODE_OF_CONDUCT.md) at all times.
5 |
6 | > All contributions to this code will be released under the terms of the [LICENSE](./LICENSE) of this code. By submitting a pull request or filing a bug, issue, or feature request, you are agreeing to comply with this waiver of copyright interest. Details can be found in our [LICENSE](./LICENSE).
7 |
8 | There are two primary ways to contribute:
9 |
10 | 1. Using the issue tracker
11 | 2. Changing the codebase
12 |
13 |
14 | ## Using the issue tracker
15 |
16 | Use the issue tracker to suggest feature requests, report bugs, and ask questions. This is also a great way to connect with the developers of the project as well as others who are interested in this solution.
17 |
18 | Use the issue tracker to find ways to contribute. Find a bug or a feature, mention in the issue that you will take on that effort, then follow the _Changing the codebase_ guidance below.
19 |
20 |
21 | ## Changing the codebase
22 |
23 | Generally speaking, you should fork this repository, make changes in your own fork, and then submit a pull request. All new code should have associated unit tests (if applicable) that validate implemented features and the presence or lack of defects.
24 |
25 | Additionally, the code should follow any stylistic and architectural guidelines prescribed by the project. In the absence of such guidelines, mimic the styles and patterns in the existing codebase.
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2020, Cisco Systems, Inc. and/or its affiliates
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | * Redistributions of source code must retain the above copyright notice, this
9 | list of conditions and the following disclaimer.
10 |
11 | * Redistributions in binary form must reproduce the above copyright notice,
12 | this list of conditions and the following disclaimer in the documentation
13 | and/or other materials provided with the distribution.
14 |
15 | * Neither the name of the copyright holder nor the names of its
16 | contributors may be used to endorse or promote products derived from
17 | this software without specific prior written permission.
18 |
19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 |
--------------------------------------------------------------------------------
/NOTICE:
--------------------------------------------------------------------------------
1 | devasc-code-examples
2 |
3 | Copyright (c) 2020, Cisco Systems, Inc. and/or its affiliates
4 |
5 | This project includes software developed at Cisco Systems, Inc. and/or its affiliates.
6 |
--------------------------------------------------------------------------------
/course.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CiscoDevNet/devasc-code-examples/9d7332f496abdfd8ba55675728427b8c15aaca23/course.png
--------------------------------------------------------------------------------
/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CiscoDevNet/devasc-code-examples/9d7332f496abdfd8ba55675728427b8c15aaca23/demo.gif
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Cisco DevNet Associate Fundamentals Course code examples
2 |
3 | The DevNet Associate Fundaments course has been retired from the DevNet site. This repo will be archived and then removed in a month.
4 |
5 | One of the best ways to study for the [Cisco DevNet Associate Certification](https://developer.cisco.com/certification/) is through hands-on practice using worked examples.
6 |
7 | ## Requirements
8 |
9 | Python 3.7 or higher
10 |
11 | ## Instructions
12 |
13 | You can clone this repo locally to work within your own development environment. To set up a developer environment, you can refer to the [DevNet Learning Labs](https://developer.cisco.com/learning-labs/setup/?utm_campaign=github21&utm_source=website&utm_medium=github-devasc-code-examples).
14 |
15 | The `master` branch contains the blank files that you can fill in during the course.
16 |
17 | The `solutions` branch contains the working code.
18 |
19 | The `src` folder contains code examples for all the hands-on exercises so you can try them in your own development environment.
20 |
21 | This code requires Python3. The [requirements.txt](./requirements.txt) file lists all the dependencies required by the code used in the course. Follow the instructions below to setup a local developerment environment that matches the in-browser development environment used in the course. Here's a quick walkthrough.
22 |
23 | 
24 |
25 | ## Get a local copy of the code
26 |
27 | 1. Clone the repository. For example, `git clone https://github.com/CiscoDevNet/devasc-code-examples.git`.
28 | 2. Change to the directory that contains the code files: `cd devasc-code-examples/`.
29 |
30 | ## Set up a Python Virtual Environment
31 |
32 | You want to work in a [Python virtual environment](https://docs.python.org/3/tutorial/venv.html) so that you can be certainly only the required dependencies are installed and used for this project.
33 |
34 | > Note: This repository does not contain the source code for the Library REST API example included with the course development environment. You cannot run the `main.py` file and make calls successfully without the service available in the course.
35 |
36 | ### MacOS or Linux
37 |
38 | 1. `python3 -m venv venv`
39 | 2. `source venv/bin/activate`
40 | 3. `pip install -r requirements.txt`
41 |
42 | ### Windows - recommendation to use git-bash terminal
43 |
44 | 1. `py -3 -m venv venv`
45 | 2. `source venv/Scripts/activate`
46 | 3. `pip install -r requirements.txt`
47 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | PyYAML
2 | ansible==2.9.2
3 | requests
4 | flask
5 | pyotp==2.3.0
6 | pysqlite3==0.4.1
7 |
--------------------------------------------------------------------------------
/src/aci/aci-get-tenants.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with code from the ACI hands-on lab
2 |
--------------------------------------------------------------------------------
/src/ansible/ansible.cfg:
--------------------------------------------------------------------------------
1 | # Add to this file for the Read Information Ansible lab
2 |
--------------------------------------------------------------------------------
/src/ansible/checklocalinfo.yml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CiscoDevNet/devasc-code-examples/9d7332f496abdfd8ba55675728427b8c15aaca23/src/ansible/checklocalinfo.yml
--------------------------------------------------------------------------------
/src/ansible/hosts:
--------------------------------------------------------------------------------
1 | # Enter the hosts or devices for Ansible playbooks
2 |
--------------------------------------------------------------------------------
/src/ansible/servers:
--------------------------------------------------------------------------------
1 | # Enter the hosts or devices for Ansible playbooks
2 |
--------------------------------------------------------------------------------
/src/ansible/writefile.yml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CiscoDevNet/devasc-code-examples/9d7332f496abdfd8ba55675728427b8c15aaca23/src/ansible/writefile.yml
--------------------------------------------------------------------------------
/src/coding-basics/circleClass.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code from the Coding Basics - Classes exercise
2 |
--------------------------------------------------------------------------------
/src/coding-basics/data_structures.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code for Python practice with data structures
2 |
--------------------------------------------------------------------------------
/src/coding-basics/devfun.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code from the course introduction
2 |
--------------------------------------------------------------------------------
/src/coding-basics/feedme.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code from the introduction to Python
2 |
--------------------------------------------------------------------------------
/src/coding-basics/hands_on_lab.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code from the introduction to Python
2 |
3 | # TRYIT: Write a print statement that displays both the type and value of Pi
4 |
5 | # TRYIT: Write a conditional to print out if `i` is less than or greater than 50
6 |
7 | # TRYIT: Write a conditional that prints the color of the picked fruit
8 |
9 | # TRYIT: Write a function that multiplies two numbers and returns the result
10 |
11 | # TRYIT: Write a function that multiplies two numbers and returns the result
12 |
13 | # TRYIT: Now call the function a few times to calculate the following answers
14 |
--------------------------------------------------------------------------------
/src/coding-basics/looping.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code for Python looping exercise
2 |
--------------------------------------------------------------------------------
/src/coding-basics/random_quote.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 | """Script flow and debugging. Print your own quote!"""
4 |
5 |
6 | import random
7 |
8 |
9 | QUOTES = [
10 | "I see a DevNet Certification coming soon.",
11 | "All promises are either broken or kept. Or rejected.",
12 | "If you lose your temper, don't go looking for it.",
13 | ]
14 |
15 |
16 | def generate_quote() -> str:
17 | """Use a random selection to choose a random quote from the list."""
18 | return random.choice(QUOTES)
19 |
20 |
21 | def generate_lucky_numbers(how_many: int) -> list:
22 | """Returns a list of (random) 'lucky' numbers."""
23 | lucky_numbers = []
24 | for _ in range(how_many):
25 | lucky_numbers.append(random.randint(0, 99))
26 | return lucky_numbers
27 |
28 |
29 | def create_random_quote(how_many_lucky_numbers: int) -> str:
30 | """Create and return a random quote.
31 |
32 | The message should include the user's quote and lucky numbers.
33 | """
34 | # TRYIT: Create a random quote by calling generate_quote() and
35 | # generate_lucky_numbers() and then composing and returning the quote.
36 |
37 |
38 | return "{quote}\nLucky Numbers: {lucky_numbers}".format(
39 | quote = quote,
40 | lucky_numbers = lucky_numbers,
41 | )
42 |
43 |
44 | def main():
45 | """Create and print a quote."""
46 | print("Get your quote!")
47 |
48 | # Prompt the user for how many lucky numbers they would like
49 | qty_lucky_numbers = input("Also, how many lucky numbers would you like? ")
50 | qty_lucky_numbers = int(qty_lucky_numbers.strip())
51 |
52 | # Create and display the response
53 | random_quote = create_random_quote(qty_lucky_numbers)
54 | print("\nHere is your quote:\n")
55 | print(random_quote)
56 |
57 |
58 | if __name__ == '__main__':
59 | main()
60 |
--------------------------------------------------------------------------------
/src/coding-basics/slide.py:
--------------------------------------------------------------------------------
1 | ## TRYIT: Import the required math functions
2 |
3 | # TRYIT: Create variables to store the triangle sides input by the user
4 |
5 | # TRYIT: Use the int() function to convert the input string values to integers
6 |
7 | # TRYIT: Calculate the values
8 |
9 | # TRYIT: Create a Boolean variable to store true or false if the slide length meets safety standards
10 |
11 | # TRYIT: Create an if...elif...else statement to test the measurements of the slide
12 |
13 | # TRYIT Use an if...else statement to test whether the Boolean variable is True or False, and print the results
14 |
--------------------------------------------------------------------------------
/src/coding-basics/structure.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CiscoDevNet/devasc-code-examples/9d7332f496abdfd8ba55675728427b8c15aaca23/src/coding-basics/structure.py
--------------------------------------------------------------------------------
/src/coding-basics/variable_scope.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code for Python practice with script structures
2 |
--------------------------------------------------------------------------------
/src/deployment/testscript.sh:
--------------------------------------------------------------------------------
1 | # You can add to this file in the editor
2 |
--------------------------------------------------------------------------------
/src/dna-center/dna-center-authenticate.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code from the DNA Center authenticate exercise
2 |
--------------------------------------------------------------------------------
/src/dna-center/get_client_health.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code from the DNA Center Get Client Health exercise
2 |
--------------------------------------------------------------------------------
/src/dna-center/get_network_devices.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code from the DNA Center Get Network Devices exercise
2 |
--------------------------------------------------------------------------------
/src/dna-center/get_network_devices_list.py:
--------------------------------------------------------------------------------
1 | # Fill in this file with the code from DNA Center Get Network Devices List exercise
2 |
--------------------------------------------------------------------------------
/src/meraki/devices-list.py:
--------------------------------------------------------------------------------
1 | # Add code for the Meraki hands-on lab here
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/meraki/merakiapis.py:
--------------------------------------------------------------------------------
1 | # Add code for the Meraki hands-on lab here
2 |
--------------------------------------------------------------------------------
/src/meraki/networks-list.py:
--------------------------------------------------------------------------------
1 | # Add code for the Meraki hands-on lab here
2 |
3 |
4 |
--------------------------------------------------------------------------------
/src/meraki/networks-loop.py:
--------------------------------------------------------------------------------
1 | # Add code for the Meraki hands-on lab here
2 |
3 |
--------------------------------------------------------------------------------
/src/meraki/organization-list.py:
--------------------------------------------------------------------------------
1 | # Add code for the Meraki hands-on lab here
2 |
3 |
--------------------------------------------------------------------------------
/src/meraki/organization-loop.py:
--------------------------------------------------------------------------------
1 | # Add code for the Meraki hands-on lab here
2 |
3 |
--------------------------------------------------------------------------------
/src/meraki/pagination-next.py:
--------------------------------------------------------------------------------
1 | # Add code for the Meraki hands-on lab here
2 |
--------------------------------------------------------------------------------
/src/meraki/pagination.py:
--------------------------------------------------------------------------------
1 | # Add code for the Meraki hands-on lab here
2 |
--------------------------------------------------------------------------------
/src/meraki/serial-list.py:
--------------------------------------------------------------------------------
1 | # Add code for the Meraki hands-on lab here
2 |
3 |
--------------------------------------------------------------------------------
/src/nso/get-devices.py:
--------------------------------------------------------------------------------
1 | # Add code from the NSO hands-on lab here
2 |
3 |
--------------------------------------------------------------------------------
/src/nso/get-services.py:
--------------------------------------------------------------------------------
1 | # Add code from the NSO hands-on lab here
2 |
3 |
--------------------------------------------------------------------------------
/src/nso/loopbackdevnet.py:
--------------------------------------------------------------------------------
1 | # Add code from the NSO hands-on lab here
2 |
3 |
--------------------------------------------------------------------------------
/src/parsing/myfile.json:
--------------------------------------------------------------------------------
1 | {
2 | "access_token":"ZDI3MGEyYzQtNmFlNS00NDNhLWFlNzAtZGVjNjE0MGU1OGZmZWNmZDEwN2ItYTU3",
3 | "expires_in":1209600,
4 | "refresh_token":"MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyMzQ1Njc4OTEyMzQ1Njc4",
5 | "refreshtokenexpires_in":7776000
6 | }
7 |
--------------------------------------------------------------------------------
/src/parsing/myfile.xml:
--------------------------------------------------------------------------------
1 |
2 |