Copyright 2015, Cisco Systems, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# END OF SUPPORT
As of **18th August 2020** this application is no longer maintained. Developers are free to use the code as-is, including forking, but no more updates will be forthcoming from the project maintainers and any new or outstanding issues will neither be tracked nor responded to.
For a potential alternative, see [YANG Suite](https://developer.cisco.com/yangsuite/).
# 1. Description
An open-source Yang Browser and RPC Builder Application to experiment with Yang Data Models
**Features**
- Upload / Compile yang models from User Interface Or Command Line
- Build NetConf RPC
- Generate Python example code **[new]**
- Search yang xpaths **[new]**
- Execute RPC against real netconf server
- Save created RPCs to collections for later use
- Build dependency graph for models
- Browse data model tree and inspect yang properties
Restconf support is **experimental**
This application is under Beta mode, contributions / suggestions are welcome !!
##### Screenshots:
![alt tag](https://github.com/CiscoDevNet/yang-explorer/blob/master/docs/images/explorer.png)
![alt tag](https://github.com/CiscoDevNet/yang-explorer/blob/master/docs/images/graph.png)
![alt tag](https://github.com/CiscoDevNet/yang-explorer/blob/master/docs/images/script.png)
![alt tag](https://github.com/CiscoDevNet/yang-explorer/blob/master/docs/images/netconf-operations.png)
# 2. Installation
## 2.1 First time installation
### Prerequisite:
- MAC, Linux (not supported on Windows)
- python 2.7
- pip package manager (https://pip.pypa.io/en/stable/installing/)
```bash
If already installed, make sure that pip / setuptools are upto date (commands may vary)
pip install --upgrade pip
Ubuntu: sudo pip install --upgrade setuptools
```
- virtualenv (recommended)
```bash
Ubuntu: sudo apt-get install python-virtualenv
Fedora: sudo dnf install python-virtualenv
MAC: sudo pip install virtualenv
```
- graphviz (http://www.graphviz.org/Download.php)
```bash
Ubuntu: sudo apt-get install graphviz
Fedora: sudo dnf install graphviz
MAC: brew install graphviz
```
- Browser with latest flash plugin (tested with google chrome)
### Download and install:
```bash
git clone https://github.com/CiscoDevNet/yang-explorer.git
cd yang-explorer
bash setup.sh
Note: sudo may be required if you do not use virtualenv.
```
See section 7 Troubleshooting for more:
```bash
If you get installation error for missing python.h or xmlversion.h try installing
dependency packages:
Ubuntu: sudo apt-get install libxml2-dev libxslt1-dev python-dev zlib1g-dev
Fedora: sudo dnf install libxml2-devel libxslt-devel python-devel zlib-devel
```
## 2.2 Update exising installation
```bash
cd <install-root>/yang-explorer
git stash (if you have local changes)
git pull origin
git stash apply (if you have local changes)
bash setup.sh
```
## 2.3 Backing up data
YangExplorer data can be backed up from data directory and it is portable to new servers -
```bash
cp -r <install-root>/yang-explorer/server/data <backup-location>/data
```
**Restore from backup location -**
```bash
cd <install-root>/yang-explorer/server
# move current data to tmp location
mv data data_old
# replace data from backup location
cp -r <backup-location>/data data
```
# 3. Running YangExplorer
## 3.1 Running with localhost
### Start Server:
```bash
cd <install-root>/yang-explorer
[sudo] ./start.sh &
Note: sudo may be required if you did not use virtualenv during installation.
```
### Start Explorer:
```bash
http://localhost:8088/static/YangExplorer.html
```
## 3.2 Running with ip-address (Shared server)
### Start Server:
```bash
# Determine <ip-address> using if-config
# Add ip-address/port in YangExplorer.html after following line:
cd <install-root>/yang-explorer/server/static
vi YangExplorer.html
var flashvars = {};
+ flashvars.host = '<ip-address>';
+ flashvars.port = '8088';
# save & quit
# Update ip-address in startup script
cd <install-root>/yang-explorer
vi start.sh
(update HOST variable with <ip-address>)
# save & quit
./start.sh
Note: sudo may be required if you did not use virtualenv during installation.
```
### Start Explorer:
```bash
http://<ip-address>:8088/static/YangExplorer.html
```
# 4. Caveats
- Yang Model upload fails, Workaround: Use Google Chrome.
- See section 6 Troubleshooting for more:
### 5. User Guide (TBD)
## 5.1 Work Flow
### 5.2.1 Login:
YangExplorer uses user accounts to manage workspaces. You can create a user account using admin page (See 5.3.1 Creating User Account) or use the predefined login (guest/guest). You must login (click on the Login button on top right corner)
You can use guest login **(guest/guest)** or newly created account.
![alt tag](https://github.com/CiscoDevNet/yang-explorer/blob/master/docs/images/YangExplorer.png)
### 5.2.2 Adding/Deleing Yang Models:
#### Upload using yang-explorer user interface (TBD: screen shot is out-of-date)
![alt tag](https://github.com/CiscoDevNet/yang-explorer/blob/master/docs/images/manage.png)
- Click **Manage Models** tab
- Click **Workspace** tab
- Click **Add** button
- Click **Browse** and select models to upload
- Click *Upload*
- **Clear** button can be used clear models in upload window
- Click Subscribe & Un-subscribe buttons to make selected models visible/invisible in explorer area
- Click Delete button to delete selected models from user account
#### Sync from Device
- Click **Manage Models** tab
- Click **Device** tab
- Select a device from profile list
- YangExplorer will list yang models on device
- Select models to Sync to YangExplorer Workspace
- **Sync** button to Sync Models to YangExplorer
- You may encounter these error during sync:
- Missing models: Select missing models from the list and try sync again
- Duplicate models: In workspace tab, select duplicate models and delete
- Click **Workspace** tab
- Click Subscribe & Un-subscribe buttons to make selected models visible/invisible in explorer area
- Click Delete button to delete selected models from user account
#### Upload models using server console
```bash
cd <install-root>/yang-explorer
source v/bin/activate
cd server
python manage.py --user <username> --git <git-url> --dir <path/to/yang/models>
example: local upload (assumes models are already available at dir path)
python manage.py bulkupload --user guest --dir /users/prgohite/git/yang/vendor/cisco/xr/531
example: git upload
python manage.py bulkupload --user guest --git https://github.com/YangModels/yang.git --dir vendor/cisco/xr/531
```
All models must be compiled successfully, in case of any error none of the models will be uploaded to yang-explorer.
### 5.2.3 Generating the model dependency graph:
- Click **Manage Models** tab
- Click **Workspace** tab
- Select one or more model name to get dependency graph
- If no models are selected, all subscribed model will be used to generate graph
- Click Graph buttons to generate graph
### 5.2.4 Creating RPCs:
You can explore yang models in explorer area (left pane) using tree navigation:
![alt tag](https://github.co
评论0