|
1 | 1 | {
|
2 | 2 | "info": {
|
3 | 3 | "_postman_id": "dadbd3d3-26e1-4c81-9d53-449d3dc0aa0b",
|
4 |
| - "name": "Mist Runner Collections 0.3.9.0", |
| 4 | + "name": "Mist Runner Collections 0.3.9.1", |
5 | 5 | "description": "This collection will use a CSV Template to create multiple sites via the Mist API .\n\nIt also uses a google API to get the lat/long of the address and use the properly formatted address returned from Google Maps.\n\n\nRequired Environmental Variables:\n\n{{apitoken}} This your Mist dashboard API token. It should have permissions to create sites\n{{google_api_token}} This is a google API token that has access to geocode APIs.\n\n\nCSV Required Values:\nsite_name\nsite_address (Note, must be URL Encoded (replace \" \" with \"+\" and enclosed in quotes)\n\nCSV Optional Values:\nsite_groups\nrf_template_id\n\nExample CSV:\n\nsite_name,site_address,site_groups,rf_template_id\n```\nAdonis,\"5592+S+Adonis+Pl,+Boise,+ID+83716\",xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n```",
|
6 | 6 | "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
7 | 7 | },
|
|
2461 | 2461 | }
|
2462 | 2462 | ]
|
2463 | 2463 | },
|
| 2464 | + { |
| 2465 | + "name": "Manage Site Variables", |
| 2466 | + "item": [ |
| 2467 | + { |
| 2468 | + "name": "getSiteIDByName_sitevars", |
| 2469 | + "event": [ |
| 2470 | + { |
| 2471 | + "listen": "test", |
| 2472 | + "script": { |
| 2473 | + "exec": [ |
| 2474 | + "console.log(`Starting Site ${pm.iterationData.get(\"site_name\")}`)", |
| 2475 | + "var nextRequest = null", |
| 2476 | + "var foundDup = false", |
| 2477 | + "var jsonData = JSON.parse(responseBody);", |
| 2478 | + "", |
| 2479 | + "", |
| 2480 | + "", |
| 2481 | + "if (!!pm.collectionVariables.get(\"c_site_name\")) {", |
| 2482 | + " console.info(`searching for site ${pm.collectionVariables.get(\"c_site_name\")} `);", |
| 2483 | + " for (var i = 0; i < jsonData.length; i++) {", |
| 2484 | + " if (jsonData[i].name == pm.collectionVariables.get(\"c_site_name\")) {", |
| 2485 | + " pm.collectionVariables.set(\"c_site_id\", jsonData[i].id)", |
| 2486 | + " console.info(\"Found Site\")", |
| 2487 | + " console.info(`Site ID = ${pm.collectionVariables.get(\"c_site_id\")}`)", |
| 2488 | + " nextRequest = \"getSiteSettings_sitevars\"", |
| 2489 | + " }", |
| 2490 | + " }", |
| 2491 | + "}", |
| 2492 | + "else if (!!pm.iterationData.get(\"id\")) {", |
| 2493 | + " pm.collection.set(\"c_site_id\", pm.iterationData.get(\"id\"))", |
| 2494 | + " nextRequest = \"updateSiteSettings - Generic\"", |
| 2495 | + "};", |
| 2496 | + "", |
| 2497 | + "pm.test(\"Status code is 200\", function() {", |
| 2498 | + " pm.expect(pm.response.code).to.equal(200);", |
| 2499 | + "});", |
| 2500 | + "", |
| 2501 | + "pm.test(\"site_id is set\", function() {", |
| 2502 | + " pm.expect(!!pm.collectionVariables.get(\"c_site_id\"));", |
| 2503 | + "});", |
| 2504 | + "", |
| 2505 | + "console.log(`setting next request ${nextRequest}`);", |
| 2506 | + "postman.setNextRequest(nextRequest);" |
| 2507 | + ], |
| 2508 | + "type": "text/javascript" |
| 2509 | + } |
| 2510 | + }, |
| 2511 | + { |
| 2512 | + "listen": "prerequest", |
| 2513 | + "script": { |
| 2514 | + "exec": [ |
| 2515 | + "// Ensure all collection variables are removed before running.", |
| 2516 | + "pm.collectionVariables.unset(\"c_site_name\");", |
| 2517 | + "pm.collectionVariables.unset(\"c_site_id\");", |
| 2518 | + "//Handling of digit only sites with quotes.", |
| 2519 | + "var formatted_string = pm.iterationData.get(\"site_name\")", |
| 2520 | + "if (!!pm.iterationData.get(\"site_name\")) {", |
| 2521 | + " if (formatted_string.includes(\"\\'\") || formatted_string.includes(\"\\\"\")) {", |
| 2522 | + " console.info(\"stripping formatting of site_name\")", |
| 2523 | + " formatted_string = formatted_string.replace(/'/g, \"\");", |
| 2524 | + " formatted_string = formatted_string.replace(/\"/g, \"\");", |
| 2525 | + " console.log(`Formatted Name ${formatted_string}`);", |
| 2526 | + " pm.collectionVariables.set(\"c_site_name\", formatted_string)", |
| 2527 | + " }", |
| 2528 | + " else {", |
| 2529 | + " pm.collectionVariables.set(\"c_site_name\", pm.iterationData.get(\"site_name\"))", |
| 2530 | + " }", |
| 2531 | + "}", |
| 2532 | + "else if (!!pm.iterationData.get(\"name\")) {", |
| 2533 | + " pm.collectionVariables.set(\"c_site_name\", pm.iterationData.get(\"name\"))", |
| 2534 | + " }", |
| 2535 | + "console.info(`Site Name = ${pm.collectionVariables.get(\"c_site_name\")}`)" |
| 2536 | + ], |
| 2537 | + "type": "text/javascript" |
| 2538 | + } |
| 2539 | + } |
| 2540 | + ], |
| 2541 | + "request": { |
| 2542 | + "method": "GET", |
| 2543 | + "header": [], |
| 2544 | + "url": { |
| 2545 | + "raw": "https://{{host}}/api/v1/orgs/:orgr_id/sites", |
| 2546 | + "protocol": "https", |
| 2547 | + "host": [ |
| 2548 | + "{{host}}" |
| 2549 | + ], |
| 2550 | + "path": [ |
| 2551 | + "api", |
| 2552 | + "v1", |
| 2553 | + "orgs", |
| 2554 | + ":orgr_id", |
| 2555 | + "sites" |
| 2556 | + ], |
| 2557 | + "variable": [ |
| 2558 | + { |
| 2559 | + "key": "orgr_id", |
| 2560 | + "value": "{{org_id}}" |
| 2561 | + } |
| 2562 | + ] |
| 2563 | + } |
| 2564 | + }, |
| 2565 | + "response": [] |
| 2566 | + }, |
| 2567 | + { |
| 2568 | + "name": "getSiteSettings_sitevars", |
| 2569 | + "event": [ |
| 2570 | + { |
| 2571 | + "listen": "test", |
| 2572 | + "script": { |
| 2573 | + "exec": [ |
| 2574 | + "var jsonData = JSON.parse(responseBody);", |
| 2575 | + "", |
| 2576 | + "", |
| 2577 | + "pm.test(\"Status code is 200\", function () {", |
| 2578 | + " pm.response.to.have.status(200);", |
| 2579 | + "});", |
| 2580 | + "", |
| 2581 | + "", |
| 2582 | + "existing_vars = {}", |
| 2583 | + "if (\"vars\" in jsonData) {", |
| 2584 | + " if (!!jsonData['vars']) {", |
| 2585 | + " for (const key in jsonData['vars']) {", |
| 2586 | + " existing_vars[key] = jsonData['vars'][key]", |
| 2587 | + " }", |
| 2588 | + " }", |
| 2589 | + "}", |
| 2590 | + "pm.collectionVariables.set(\"c_existing_vars\", JSON.stringify(existing_vars))", |
| 2591 | + "csv_data = pm.iterationData.toObject()", |
| 2592 | + "", |
| 2593 | + "for (const key in csv_data) {", |
| 2594 | + " console.info(`Key: ${key} Value: ${csv_data[key]}`)", |
| 2595 | + " if (key != \"site_name\" & !!csv_data[key]) {", |
| 2596 | + " existing_vars[key] = csv_data[key]", |
| 2597 | + " }", |
| 2598 | + " else if (key != \"site_name\" & !!existing_vars[key]){", |
| 2599 | + " if (key in existing_vars) {", |
| 2600 | + " delete existing_vars[key]", |
| 2601 | + " }", |
| 2602 | + " }", |
| 2603 | + "}", |
| 2604 | + "", |
| 2605 | + "pm.collectionVariables.set(\"c_sitevars\", JSON.stringify(existing_vars))", |
| 2606 | + "", |
| 2607 | + "" |
| 2608 | + ], |
| 2609 | + "type": "text/javascript" |
| 2610 | + } |
| 2611 | + } |
| 2612 | + ], |
| 2613 | + "request": { |
| 2614 | + "method": "GET", |
| 2615 | + "header": [], |
| 2616 | + "url": { |
| 2617 | + "raw": "https://{{host}}/api/v1/sites/:site_id/setting", |
| 2618 | + "protocol": "https", |
| 2619 | + "host": [ |
| 2620 | + "{{host}}" |
| 2621 | + ], |
| 2622 | + "path": [ |
| 2623 | + "api", |
| 2624 | + "v1", |
| 2625 | + "sites", |
| 2626 | + ":site_id", |
| 2627 | + "setting" |
| 2628 | + ], |
| 2629 | + "variable": [ |
| 2630 | + { |
| 2631 | + "key": "site_id", |
| 2632 | + "value": "{{c_site_id}}", |
| 2633 | + "type": "string" |
| 2634 | + } |
| 2635 | + ] |
| 2636 | + } |
| 2637 | + }, |
| 2638 | + "response": [] |
| 2639 | + }, |
| 2640 | + { |
| 2641 | + "name": "updateSiteSettings_sitevars", |
| 2642 | + "event": [ |
| 2643 | + { |
| 2644 | + "listen": "prerequest", |
| 2645 | + "script": { |
| 2646 | + "exec": [ |
| 2647 | + "function isJson(str) {", |
| 2648 | + " console.info(`PAYLOAD: ${str}`)", |
| 2649 | + " try {", |
| 2650 | + " test = JSON.parse(str);", |
| 2651 | + " console.info(`results: ${test}`)", |
| 2652 | + " return true;", |
| 2653 | + " } catch (e) {", |
| 2654 | + " console.info(\"BAD JSON\")", |
| 2655 | + " return false;", |
| 2656 | + " }", |
| 2657 | + "}", |
| 2658 | + "", |
| 2659 | + "jsonPayload = pm.request.body.toString()", |
| 2660 | + "console.info(jsonPayload)" |
| 2661 | + ], |
| 2662 | + "type": "text/javascript" |
| 2663 | + } |
| 2664 | + }, |
| 2665 | + { |
| 2666 | + "listen": "test", |
| 2667 | + "script": { |
| 2668 | + "exec": [ |
| 2669 | + "pm.test(\"Status code is 200\", function() {", |
| 2670 | + " pm.expect(pm.response.code).to.equal(200);", |
| 2671 | + "});" |
| 2672 | + ], |
| 2673 | + "type": "text/javascript" |
| 2674 | + } |
| 2675 | + } |
| 2676 | + ], |
| 2677 | + "request": { |
| 2678 | + "method": "PUT", |
| 2679 | + "header": [ |
| 2680 | + { |
| 2681 | + "key": "Content-Type", |
| 2682 | + "type": "text", |
| 2683 | + "value": "application/json" |
| 2684 | + }, |
| 2685 | + { |
| 2686 | + "key": "Accept", |
| 2687 | + "type": "text", |
| 2688 | + "value": "application/json" |
| 2689 | + }, |
| 2690 | + { |
| 2691 | + "key": "X-CSRFToken", |
| 2692 | + "type": "text", |
| 2693 | + "value": "{{csrftoken}}" |
| 2694 | + } |
| 2695 | + ], |
| 2696 | + "body": { |
| 2697 | + "mode": "raw", |
| 2698 | + "raw": "{\n \"vars\": {{c_sitevars}}\n}", |
| 2699 | + "options": { |
| 2700 | + "raw": { |
| 2701 | + "language": "json" |
| 2702 | + } |
| 2703 | + } |
| 2704 | + }, |
| 2705 | + "url": { |
| 2706 | + "raw": "https://{{host}}/api/v1/sites/:site_id/setting", |
| 2707 | + "protocol": "https", |
| 2708 | + "host": [ |
| 2709 | + "{{host}}" |
| 2710 | + ], |
| 2711 | + "path": [ |
| 2712 | + "api", |
| 2713 | + "v1", |
| 2714 | + "sites", |
| 2715 | + ":site_id", |
| 2716 | + "setting" |
| 2717 | + ], |
| 2718 | + "variable": [ |
| 2719 | + { |
| 2720 | + "key": "site_id", |
| 2721 | + "value": "{{c_site_id}}" |
| 2722 | + } |
| 2723 | + ] |
| 2724 | + }, |
| 2725 | + "description": " #### Body Parameter\r\n**Parameter**|**Type**|**Description** \r\n :-------------: |:-------------: |:-------------: \r\n analytic.enabled|boolean|enable Advanced Analytic feature, default is false (using SUB-ANA license)\r\n app_waking|boolean|default is false\r\n auto_upgrade|object|auto upgrade\r\n bandwidth|int|channel width for the band, 20 / 40 / 80, 80 is only applicable for band_5\r\n ble_config|object|BLE config (see Site:BLE Config)\r\n ble|object|BLE asset settings\r\n brightness|int|0-255, default is 255\r\n channel|int|(primary) channel for the band, 0 means auto\r\n channels|list|list of channels, null or empty array means auto\r\n device_updown_threshold|int|sending AP_DISCONNECTED event in device-updowns only if AP_CONNECTED is not seen within the threshold, in minutes, 0 - 30, default is 0\r\n flags|list|name/val pair objects for location engine to use\r\n hello_interval|float|in seconds, used as heartbeat to detect if a tunnel is alive. AP will try another peer after missing N hellos specified by hello_retries. between 1 and 300, default is 60 seconds\r\n hello_retries|int|between 2 and 30, default is 7\r\n led.enabled|boolean|whether to enable LED, default is true\r\n led|object|LED control\r\n model_specific|object|overwrites for a specific model. If a band is specified, it will shadow the default.\r\n mxtunnel.mtu|int|552-1500, default is 0\r\n ntp_servers|list|list of NTP servers\r\n persist_config_on_device|boolean|whether to store the config on AP, default is false\r\n power_max|int|when power=0, min tx power to use, HW-specific values will be used if not set\r\n power_min|int|when power=0, min tx power to use, HW-specific values will be used if not set\r\n power|int|tx power of the radio, 0 mean auto\r\n preamble|string|short / long / auto, default is short\r\n proxy|object|Proxy Configuration for APs to talk to Mist\r\n radio_config|object|site RF settings\r\n remote_syslog|object|syslog parameters\r\n report_gatt|boolean|default is false; whether AP should periodically connect to BLE devices and report GATT device info (device name, manufacturer name, serial number, battery %, temperature, humidity)\r\n rogue|object|rogue detection parameters\r\n rtsa|object|managed mobility\r\n ssh_keys|list|when limit_ssh_access = true in Org Setting, list of SSH public keys provided by Mist Support to install onto APs (see Org:Setting)\r\n track_anonymous_devices|boolean|default is false; whether to track anonymous BLE assets (requires ‘track_asset’ enabled)\r\n track_asset|boolean|enable Asset Tracking, default is false (using SUB-AST license)\r\n vars|object|a dictionary of name->value, the vars can then be used in Wlans\r\n wifi|object|managed connectivity\r\n\r\n #### Wi-Fi Parameter\r\n**Parameter**|**Type**|**Description** \r\n :-------------: |:-------------: |:-------------: \r\n enabled|boolean|enable WIFI feature, default is true (using SUB-MAN license)\r\n enable_arp_spoof_check|boolean|when proxy_arp is enabled, check for arp spoofing. default is false\r\n enable_channel_144|boolean|whether to enable channel 144 (some older clients may not support in US), default is false\r\n enable_vna|boolean|enable Virtual Network Assistant, default is false (using SUB-VNA license)\r\n proxy_arp|string|default / enabled / disabled\r\n locate_unconnected|boolean|whether to locate unconnected clients, default is false\r\n mesh_enabled|boolean|whether to enable Mesh feature for the site, default is false\r\n disable_11k|boolean|whether to disable 11k, default is false\r\n \r\n #### Remote Syslog Parameter\r\n**Parameter**|**Type**|**Description** \r\n :-------------: |:-------------: |:-------------: \r\n enabled|boolean|whether or not remote syslog is enabled\r\n servers|list|list of syslog servers\r\n host|string|host to which syslog is sent\r\n protocol|string|udp / tcp, protocol to use for remote syslog, default is udp\r\n port|int|port on which to connect to host for syslog, default is 514 if protocol=udp, 6514 if protocol=tcp\r\n facility|string|kern / user / mail / daemon / auth / syslog / lpr / news / uucp / cron / authpriv / ftp / ntp / security / console / solaris-cron / local0 - local7, default is config\r\n severity|string|emerg / alert / crit / err / warning / notice / info / debug, default is info\r\n tag|string|optional, tag to attach to log record\r\n \r\n #### Rogue Detection Parameter\r\n**Parameter**|**Type**|**Description** \r\n :-------------: |:-------------: |:-------------: \r\n enabled|boolean|whether or not rogue detection is enabled\r\n honeypot_enabled|boolean|whether or not honeypot detection is enabled\r\n min_rssi|int|minimum RSSI for an AP to be considered rogue (ignoring APs that’s far away), default is -80. Minimum allowed value is -85.\r\n min_duration|int|minimum duration for a bssid to be considered rogue, maximum is 59, default is 10\r\n whitelisted_ssids|list|list of SSIDs to whitelist\r\n whitelisted_bssids|list|list of BSSIDs to whitelist\r\n \r\n #### Auto Upgrade Parameter\r\n**Parameter**|**Type**|**Description** \r\n :-------------: |:-------------: |:-------------: \r\n enabled|boolean|whether auto upgrade should happen, default is false (Note that Mist may auto-upgrade if the version is not supported)\r\n version|string|desired version, beta / stable / custom, default is stable\r\n time_of_day|string|any / HH:MM (24-hour format), upgrade will happen within up to 1-hour from this time\r\n day_of_week|string|any / mon / tue / wed / thu / fri / sat / sun\r\n custom_versions|object|custome versions for different models\r\n\r\n #### Engagement Parameter\r\n NOTE: if hours does not exist, it’s treated as everyday of the week, 00:00-23:59. Currently we don’t allow multiple ranges for the same day\r\n\r\nNOTE: default values for dwell_tags: passerby (1,300) bounce (301, 14400) engaged (14401, 28800) stationed (28801, 42000)\r\n\r\nNOTE: default values for dwell_tag_names: passerby = “Passerby”, bounce = “Visitor”, engaged = “Associates”, stationed = “Assets”\r\n\r\n\r\n**Parameter**|**Type**|**Description** \r\n :-------------: |:-------------: |:-------------: \r\n dwell_tags|object|add tags to visits within the duration (in seconds), available tags (passerby, bounce, engaged, stationed)\r\n max_dwell|int|max time, default is 43200(12h), max is 68400 (18h)\r\n min_dwell|int|min time, default is 0.\r\n hours|object|hours of operation filter, the available days (mon, tue, wed, thu, fri, sat, sun). Note: If the dow is not defined then it’s treated as 00:00-23:59.\r\n \r\n #### WIDS Parameter\r\n**Parameter**|**Type**|**Description** \r\n :-------------: |:-------------: |:-------------: \r\n threshold|int|count of events to trigger\r\nduration|int|window where a trigger will be detected and action to be taken (in seconds)\r\n\r\n #### Tunnel Parameter\r\n**Parameter**|**Type**|**Description** \r\n :-------------: |:-------------: |:-------------: \r\n hosts|list|hostnames or IPs where a Mist Tunnel will use as the Peer (i.e. they are reachable from AP)\r\nap_subnets|list|list of subnets where we allow AP to establish Mist Tunnels from\r\nprotocol|list|udp / ip, default is udp\r\nvlan_ids|list|list of vlan_ids that will be used\r\nhello_interval|float|in seconds, used as heartbeat to detect if a tunnel is alive. AP will try another peer after missing N hellos specified by hello_retries. between 1 and 300, default is 60 seconds\r\nhello_retries|int|between 2 and 30, default is 7" |
| 2726 | + }, |
| 2727 | + "response": [] |
| 2728 | + } |
| 2729 | + ], |
| 2730 | + "description": "This collection will iterate through sites and set site variables according to the CSV.\n\nYou can source the data from a CSV with `site_name`. You cannot run this from CSV, as we expect to only find `site_name` and the site variables. Every field that is NOT `site_name` will be created as a variable.\n\n## Required Environmental Variables:\n\n`apitoken` This your Mist dashboard API token. It should have permissions to modify sites\n\n## Existing site variables:\n\nExisting Site variables will be left alone. The logic is such that if you don't define a site variable in your CSV and that site variable exists on the site, it will remain after the runner is finished.\n\n## Deleting Site Variables:\n\nIf you include the site variable column on the spreadsheet but leave the value blank, the runner will remove it from the output.\n\n## Example CSV\n\nThis CSV would set values for 2 sites: \nJakeLab: {\"test1\": \"1.1.1.1\", \"test2\": 4, \"test3\": \"test\"} \nTestSite2: {\"test1\": \"2.2.2.2\", \"test2\": 5}\n\n```\nsite_name,test1,test2,test3\nJakeLab,1.1.1.1,4,test\nTestSite2,2.2.2.2,5,\n\n\n```", |
| 2731 | + "event": [ |
| 2732 | + { |
| 2733 | + "listen": "prerequest", |
| 2734 | + "script": { |
| 2735 | + "type": "text/javascript", |
| 2736 | + "exec": [ |
| 2737 | + "" |
| 2738 | + ] |
| 2739 | + } |
| 2740 | + }, |
| 2741 | + { |
| 2742 | + "listen": "test", |
| 2743 | + "script": { |
| 2744 | + "type": "text/javascript", |
| 2745 | + "exec": [ |
| 2746 | + "" |
| 2747 | + ] |
| 2748 | + } |
| 2749 | + } |
| 2750 | + ] |
| 2751 | + }, |
2464 | 2752 | {
|
2465 | 2753 | "name": "Delete Sites",
|
2466 | 2754 | "item": [
|
|
0 commit comments