Developer Tooling
Just as important as APIs and data models, proper developer tooling is needed to be successful with any platform or application.
Development Environments
DevNet Sandbox
DevNet Sandboxes are available 24x7x365 for engineers, developers, network admins, architects, or anyone else who desires to develop/test against Cisco’s APIs, controllers, network gear, collaboration suite, and more for free!
The following sandbox offers access to NX-OS:
- Open NX-OS Programmability - Always-On Lab
Vagrant
Vagrant is a popular tool for developers to quickly instantiate development environments to write and test code locally before moving to larger labs or test bed. And now you can use it to instantiate a local Nexus 9000v switch on your local workstation.
Getting Started
Install Vagrant on your workstation.
Download the Vagrant Box from CCO.
- Look for Cisco Nexus 9000/3000 Virtual Switch for Vagrant
- You will need a CCO credential to download the file
Add the box to vagrant.
vagrant box add --name n9000v nxosv-final.7.0.3.I5.2.box --force
Initialize a Vagrantfile.
vagrant init n9000v
Start the environment (vagrant up).
vagrant up
The switch will boot up but Vagrant will timeout the first time with an error like this.
Timed out while waiting for the machine to boot. This means that Vagrant was unable to communicate with the guest machine within the configured ("config.vm.boot_timeout" value) time period. If you look above, you should be able to see the error(s) that Vagrant had when attempting to connect to the machine. These errors are usually good hints as to what may be wrong. If you're using a custom box, make sure that networking is properly working and you're able to connect to the machine. It is a common problem that networking isn't setup properly in these boxes. Verify that authentication configurations are also setup properly, as well. If the box appears to be booting properly, you may want to increase the timeout ("config.vm.boot_timeout") value.
You need to complete the initial start-up config via the console connection.
On a Linux or Mac
- Use
socat
to connect withsocat unix-connect:/tmp/test stdin
- Install with package manager
- Mac with HomeBrew
brew install socat
- CentOS/RedHat
yum install socat
- Ubuntu
apt-get install socat
- Mac with HomeBrew
- Use
On a Windows machine
- Use Putty and connect to
\\.\pipe\COM1
as the Serial Line Path - Watch as switch boots and stop the auto-install process
2017 Apr 26 19:48:30 %$ VDC-1 %$ %VDC_MGR-2-VDC_ONLINE: vdc 1 has come online System is coming up ... Please wait ... Starting Auto Provisioning ... 2017 Apr 26 19:48:34 switch %$ VDC-1 %$ %USER-1-SYSTEM_MSG: SWINIT failed. devid:241 inst:0 - t2usd Done Abort Auto Provisioning and continue with normal setup ?(yes/no)[n]: 2017 Apr 26 19:48:36 switch %$ VDC-1 %$ %POAP-2-POAP_INITED: [98D1QNYZYPR-08:00:27:6C:EE:14] - POAP process itialized
- Use Putty and connect to
Abort Auto Provisioning and continue with normal setup ?(yes/no)[n]: y
y Disabling POAP
* Run through setup being sure to answer `no` for requiring secure password. Do __NOT__ enter the basic configuration dialog.
```
Do you want to enforce secure password standard (yes/no) [y]: n
Enter the password for "admin": admin
Confirm the password for "admin": admin
---- Basic System Configuration Dialog VDC: 1 ----
This setup utility will guide you through the basic configuration of the system. Setup configures only enough connectivity for management of the system.
Please register Cisco Nexus9000 Family devices promptly with your supplier. Failure to register may affect response times for initial service calls. Nexus9000 devices must be registered to receive entitled support services.
Press Enter at anytime to skip a dialog. Use ctrl-c at anytime to skip the remaining dialogs.
Would you like to enter the basic configuration dialog (yes/no): no
no
```
* If you mistakingly enable secure passwords you can disable it with this command
```
conf t
no password strength-check
```
* Login as admin/admin (or whatever password you set) and apply this initial configuration to the router
```
conf t
hostname n9kv1
interface mgmt 0
ip address dhcp
no shut
exit
username vagrant password vagrant role network-admin
```
* Set the default boot image
* First find the boot image name
```
dir bootflash:
! Abbreviated Output
dir bootflash:
757307904 Feb 16 17:17:14 2017 nxos.7.0.3.I5.2.bin
```
* Set in configuration
```
conf t
boot nxos bootflash:nxos.7.0.3.I5.2.bin
exit
```
* Save the configuration changes and exit socat with `Cntrl-C`
```
copy run start
^C
```
8. Access the environment. Use the password you set for the vagrant user in the configuration.
```
$ vagrant ssh
Password: vagrant
Bad terminal type: "xterm-256color". Will assume vt100.
Cisco NX-OS Software
Copyright (c) 2002-2017, Cisco Systems, Inc. All rights reserved.
NX-OSv9K software ("NX-OSv9K Software") and related documentation,
files or other reference materials ("Documentation") are
the proprietary property and confidential information of Cisco
Systems, Inc. ("Cisco") and are protected, without limitation,
pursuant to United States and International copyright and trademark
laws in the applicable jurisdiction which provide civil and criminal
penalties for copying or distribution without Cisco's authorization.
Any use or disclosure, in whole or in part, of the NX-OSv9K Software
or Documentation to any third party for any purposes is expressly
prohibited except as otherwise authorized by Cisco in writing.
The copyrights to certain works contained herein are owned by other
third parties and are used and distributed under license. Some parts
of this software may be covered under the GNU Public License or the
GNU Lesser General Public License. A copy of each such license is
available at
https://www.gnu.org/licenses/gpl.html and
https://www.gnu.org/licenses/lgpl.html
***************************************************************************
* NX-OSv9K is strictly limited to use for evaluation, demonstration *
* and NX-OS education. Any use or disclosure, in whole or in part of *
* the NX-OSv9K Software or Documentation to any third party for any *
* purposes is expressly prohibited except as otherwise authorized by *
* Cisco in writing. *
***************************************************************************
n9kv1#
```
9. After completing this setup you can use `vagrant halt/up` `vagrant suspend/resume` to manage the environment. If you `vagrant destroy/up` you will need to re-run step 7.
* ***Note: Vagrant won't be able to automatically login following `vagrant up` so it will either timeout or cancel with ^C. But `vagrant ssh` will prompt for the password to login with.***
## Virtual Switch
The Nexus 9000v Virtual Switch is an excellent resource for developing against NX-OS. You can deploy a fully functional NX-OS devices using hypervisors such as Virtual Box, ESXi, Fusion, or KVM. Deploy multiple switches and network them together to test larger topologies.
### Getting Started
1. Download the version for your hypervisor of choice from [CCO](https://software.cisco.com/download/release.html?mdfid=286312239&softwareid=282088129&release=7.0(:3(:I5(:2(:&relind=AVAILABLE&rellifecycle=&reltype=latest).
2. Deploy using the hypervisor tools
3. Once deployed, you will need to complete the initial device configuration via a Console connection.
* If you are using Virtual Box, you can see an example on how to connect to a console connection using `socat` in the Vagrant setup instructions above.
# Learning Labs
***The following Learning Labs are in development. Check back soon!***
## Introduction to NX-OS Programmability
* NX-OS Programmability Overview
* Guest Shell and Python Script Execution on Box
* Understanding NX-API
* Leveraging NX-OS Sandbox and Visore
* Introduction to Ansible and NX-OS
# Code Samples
Check out these repositories for some code samples related to programming against NX-OS.
* [github.com/datacenter/opennxos](https://github.com/datacenter/opennxos)
* [github.com/datacenter/nexus9000](https://github.com/datacenter/nexus9000)