Package: nautobot-chatops-meraki
Cisco Meraki ChatOpsUsing theNautobot ChatOpsbase framework, this Nautobot app (plugin) adds the ability to gather data as well as make basic changes communicating directly with the Meraki portal using Slack, Webex Teams, MS Teams, and Mattermost changing the way IT organizations support their Meraki infrastructure.UsageCommand SetupAdd a slash command to Slack called/meraki.
See thenautobot-chatops installation guidefor instructions on adding a slash command to your Slack channel.You may need to adjust yourAccess Grants in Nautobotdepending on your security requirements.The following commands are available:/meraki get-organizations:  Gather all the Meraki Organizations./meraki get-admins [org-name]: Based on an Organization Name Return the Admins./meraki get-devices [org-name] [device-type]: Gathers devices from Meraki./meraki get-networks [org-name]: Gathers networks from Meraki./meraki get-switchports [org-name] [device-name]: Gathers switch ports from a MS switch device./meraki get-switchports-status [org-name] [device-name]: Gathers switch ports status from a MS switch device./meraki get-firewall-performance [org-name] [device-name]: Query Meraki with a firewall to device performance./meraki get-network-ssids [org-name] [net-name]: Query Meraki for all SSIDs for a given Network./meraki get-camera-recent [org-name] [device-name]: Query Meraki Recent Camera Analytics./meraki get-clients [org-name] [device-name]: Query Meraki for List of Clients./meraki get-lldp-cdp [org-name] [device-name]: Query Meraki for List of LLDP or CDP Neighbors./meraki configure-basic-access-port [org-name] [device-name] [port-number] [enabled] [vlan] [port-desc]: Configure an access port with description, VLAN and state./meraki cycle-port [org-name] [device-name] [port-number]: Cycles a port on a given switch.ScreenshotsRunning/meraki get-organizations.Running/meraki get-networks.Running/meraki get-switchports-status.Since the output was cut off the output example is below:Port   Enabled      Status         Errors       Warnings   Speed    Duplex    Usage (Kb)    Client Count    Traffic In
                                                                                                              (Kbps)
========================================================================================================================
1      True      Connected                                 1 Gbps   full     total: 46687   1              total: 4.3
                                                                             sent: 27405                   sent: 2.5
                                                                             recv: 19282                   recv: 1.8
2      True      Connected                                 1 Gbps   full     total: 10086   1              total: 1.0
                                                                             sent: 9481                    sent: 0.9
                                                                             recv: 605                     recv: 0.1
3      True      Disconnected   Port                                         total: 0       0              total: 0
                                disconnected                                 sent: 0                       sent: 0
                                                                             recv: 0                       recv: 0
4      True      Disconnected   Port                                         total: 0       0              total: 0
                                disconnected                                 sent: 0                       sent: 0
                                                                             recv: 0                       recv: 0To demonstrate a example of configuration updates.  There is a simple configuration ability for access ports./meraki configure-basic-access-portSpecify Org, Switch, and Port ID.Fill out the Port Specific Configuration.Result of the configuration.InstallationThis plugin requires installation of theNautobot ChatOps plugin. Followthis linkto the installation instructions for that plugin.The plugin is available as a Python package in PYPI and can be installed with pippipinstallgit+https://github.com/networktocode-llc/nautobot-plugin-chatops-meraki.gitThe plugin is compatible with Nautobot 1.0.1 and higherTo ensure Nautobot Plugin Chatops Meraki is automatically re-installed during future upgrades, create a file namedlocal_requirements.txt(if not already existing) in the Nautobot root directory (alongsiderequirements.txt) and list thenautobot-plugin-chatops-merakipackage:# echo nautobot-plugin-chatops-meraki >> local_requirements.txtOnce installed, the plugin needs to be enabled in yournautobot_config.py# In your configuration.pyPLUGINS=["nautobot_chatops","nautobot_plugin_chatops_meraki"]PLUGINS_CONFIG={"nautobot_chatops":{# ADD SLACK/MS-TEAMS/WEBEX-TEAMS/MATTERMOST SETTINGS HERE}}To connect to the Meraki Dashboard API, you need to define Meraki Dashboard API key.
See [Meraki Dashboard API Documentation](https://documentation.meraki.com/General_Administration/Other_Topics/Cisco_Meraki_Dashboard_API).There are two options to define the API key.The first option is to define the API key in thenautobot_config.py:PLUGINS_CONFIG={"nautobot_plugin_chatops_meraki":{"meraki_dashboard_api_key":<APIKEY>},Note: You would probably want to read the API key from the env variable like this:os.environ.get("MERAKI_API_KEY")The alternative option is to set the environmental variable:MERAKI_DASHBOARD_API_KEY: Is set to the dashboard API key.
Add this variable and its value in thecreds.envfile.ContributingPull requests are welcomed and automatically built and tested against multiple version of Python and multiple version of Nautobot through TravisCI.The project is packaged with a light development environment based ondocker-composeto help with the local development of the project and to run the tests within TravisCI.The project is following Network to Code software development guideline and is leveraging:Black, Pylint, Bandit and pydocstyle for Python linting and formatting.Django unit test to ensure the plugin is working properly.Development EnvironmentThe development environment can be used in 2 ways. First, with a local poetry environment if you wish to develop outside of Docker. Second, inside of a docker container.Invoke tasksThePyInvokelibrary is used to provide some helper commands based on the environment.  There are a few configuration parameters which can be passed to PyInvoke to override the default configuration:nautobot_ver: the version of Nautobot to use as a base for any built docker containers (default: latest)project_name: the default docker compose project name (default: nautobot-plugin-chatops-meraki)python_ver: the version of Python to use as a base for any built docker containers (default: 3.6)local: a boolean flag indicating if invoke tasks should be run on the host or inside the docker containers (default: False, commands will be run in docker containers)compose_dir: the full path to a directory containing the project compose filescompose_files: a list of compose files applied in order (seeMultiple Compose filesfor more information)Using PyInvoke these configuration options can be overridden usingseveral methods.  Perhaps the simplest is simply setting an environment variableINVOKE_NAUTOBOT-PLUGIN-CHATOPS-MERAKI_VARIABLE_NAMEwhereVARIABLE_NAMEis the variable you are trying to override.  The only exception iscompose_files, because it is a list it must be overridden in a yaml file.  There is an exampleinvoke.ymlin this directory which can be used as a starting point.Local Poetry Development EnvironmentCopydevelopment/creds.env.exampletodevelopment/creds.env(This file will be ignored by git and docker)Uncomment thePOSTGRES_HOST,REDIS_HOST, andNAUTOBOT_ROOTvariables indevelopment/creds.envCreate an invoke.yml with the following contents at the root of the repo:---
nautobot_plugin_chatops_meraki:local:truecompose_files:-"docker-compose.requirements.yml"Run the following commands:poetryshell
poetryinstallexport$(catdevelopment/dev.env|xargs)export$(catdevelopment/creds.env|xargs)You can now run nautobot-server commands as you would from theNautobot documentationfor example to start the development server:nautobot-serverrunserver0.0.0.0:8080--insecureNautobot server can now be accessed athttp://localhost:8080.Docker Development EnvironmentThis project is managed byPython Poetryand has a few requirements to setup your development environment:Install Poetry, see thePoetry Documentationfor your operating system.Install Docker, see theDocker documentationfor your operating system.Once you have Poetry and Docker installed you can run the following commands to install all other development dependencies in an isolated python virtual environment:poetryshell
poetryinstall
invokestartNautobot server can now be accessed athttp://localhost:8080.CLI Helper CommandsThe project is coming with a CLI helper based oninvoketo help setup the development environment. The commands are listed below in 3 categoriesdev environment,utilityandtesting.Each command can be executed withinvoke <command>. Environment variablesINVOKE_NAUTOBOT-PLUGIN-CHATOPS-MERAKI_PYTHON_VERandINVOKE_NAUTOBOT-PLUGIN-CHATOPS-MERAKI_NAUTOBOT_VERmay be specified to override the default versions. Each command also has its own helpinvoke <command> --helpDocker dev environmentbuild            Build all docker images.
  debug            Start Nautobot and its dependencies in debug mode.
  destroy          Destroy all containers and volumes.
  restart          Restart Nautobot and its dependencies.
  start            Start Nautobot and its dependencies in detached mode.
  stop             Stop Nautobot and its dependencies.Utilitycli              Launch a bash shell inside the running Nautobot container.
  create-user      Create a new user in django (default: admin), will prompt for password.
  makemigrations   Run Make Migration in Django.
  nbshell          Launch a nbshell session.Testingbandit           Run bandit to validate basic static code security analysis.
  black            Run black to check that Python files adhere to its style standards.
  flake8           This will run flake8 for the specified name and Python version.
  pydocstyle       Run pydocstyle to validate docstring formatting adheres to NTC defined standards.
  pylint           Run pylint code analysis.
  tests            Run all tests for this plugin.
  unittest         Run Django unit tests for the plugin.QuestionsFor any questions or comments, please check theFAQfirst and feel free to swing by theNetwork to Code slack channel(channel #networktocode).
Sign uphere