Class: MistApi::Installer
- Inherits:
-
BaseController
- Object
- BaseController
- MistApi::Installer
- Defined in:
- lib/mist_api/controllers/installer.rb
Overview
Installer
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#add_installer_device_image(org_id, image_name, device_mac, auto_deviceprofile_assignment: nil, csv: nil, file: nil, json: nil) ⇒ ApiResponse
Add image here here here parameter: Whether to auto assign device to deviceprofile by name mapping, optional here.
-
#claim_installer_devices(org_id, body: nil) ⇒ ApiResponse
This mirrors ‘POST /api/v1/orgs/org_id/inventory` (see Inventory API) here.
-
#create_installer_map(org_id, site_name, map_id, body: nil) ⇒ ApiResponse
Create a MAP here here here.
-
#create_installer_virtual_chassis(org_id, fpc0_mac, body: nil) ⇒ ApiResponse
For models (e.g. EX3400 and up) having dedicated VC ports, it is easier to form a VC by just connecting cables with the dedicated VC ports.
-
#create_or_update_installer_sites(org_id, site_name, body: nil) ⇒ ApiResponse
Often the Installers are asked to assign Devices to Sites.
-
#delete_installer_device_image(org_id, image_name, device_mac) ⇒ ApiResponse
Delete image here here here.
-
#delete_installer_map(org_id, site_name, map_id) ⇒ ApiResponse
Delete Map here here here.
-
#get_installer_device_virtual_chassis(org_id, fpc0_mac) ⇒ ApiResponse
Get VC Status The API returns a combined view of the VC status which includes topology and stats here.
-
#import_installer_map(org_id, site_name, auto_deviceprofile_assignment: nil, csv: nil, file: nil, json: nil) ⇒ ApiResponse
Import data from files is a multipart POST which has an file, an optional json, and an optional csv, to create floorplan, assign & place ap if name or mac matches here here parameter: Whether to auto assign device to deviceprofile by name mapping, optional here.
-
#list_installer_alarm_templates(org_id) ⇒ ApiResponse
Get List of alarm templates here.
-
#list_installer_device_profiles(org_id, type: DeviceTypeDefaultApEnum::AP) ⇒ ApiResponse
Get List of Device Profiles here.
-
#list_installer_list_of_recently_claimed_devices(org_id, model: nil, site_name: nil, site_id: nil, limit: 100, page: 1) ⇒ ApiResponse
Get List of recently claimed devices here.
-
#list_installer_maps(org_id, site_name) ⇒ ApiResponse
Get List of Maps here here.
-
#list_installer_rf_templates_names(org_id) ⇒ ApiResponse
Get List of RF Templates here.
-
#list_installer_site_groups(org_id) ⇒ ApiResponse
Get List of Site Groups here.
-
#list_installer_sites(org_id) ⇒ ApiResponse
Get List of Sites here.
-
#optimize_installer_rrm(site_name) ⇒ ApiResponse
After installation is considered complete (APs are placed on maps, all powered up), you can trigger an optimize operation where RRM will kick in (and maybe other things in the future) before it’s automatically scheduled.
-
#provision_installer_devices(org_id, device_mac, body: nil) ⇒ ApiResponse
Provision or Replace a device If replacing_mac is in the request payload, other attributes are ignored, we attempt to replace existing device (with mac replacing_mac) with the inventory device being configured.
-
#start_installer_locate_device(org_id, device_mac) ⇒ ApiResponse
Locate a Device by blinking it’s LED, it’s a persisted state that has to be stopped by calling Stop Locating API here here.
-
#stop_installer_locate_device(org_id, device_mac) ⇒ ApiResponse
Stop it here here.
-
#unassign_installer_recently_claimed_device(org_id, device_mac) ⇒ ApiResponse
Unassign recently claimed devices here here.
-
#update_installer_map(org_id, site_name, map_id, body: nil) ⇒ ApiResponse
Update map here here here.
-
#update_installer_virtual_chassis_member(org_id, fpc0_mac, body: nil) ⇒ ApiResponse
The VC creation and adding member switch API will update the device’ s virtual chassis config which is applied after VC is formed to create JUNOS pre-provisioned virtual chassis configuration.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent
Constructor Details
This class inherits a constructor from MistApi::BaseController
Instance Method Details
#add_installer_device_image(org_id, image_name, device_mac, auto_deviceprofile_assignment: nil, csv: nil, file: nil, json: nil) ⇒ ApiResponse
Add image here here here parameter: Whether to auto assign device to deviceprofile by name mapping, optional here
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
# File 'lib/mist_api/controllers/installer.rb', line 419 def add_installer_device_image(org_id, image_name, device_mac, auto_deviceprofile_assignment: nil, csv: nil, file: nil, json: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/v1/installer/orgs/{org_id}/devices/{device_mac}/{image_name}', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(image_name, key: 'image_name') .should_encode(true)) .template_param(new_parameter(device_mac, key: 'device_mac') .should_encode(true)) .form_param(new_parameter(auto_deviceprofile_assignment, key: 'auto_deviceprofile_assignment')) .multipart_param(new_parameter(csv, key: 'csv') .default_content_type('application/octet-stream')) .multipart_param(new_parameter(file, key: 'file') .default_content_type('application/octet-stream')) .form_param(new_parameter(json, key: 'json')) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .is_response_void(true) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#claim_installer_devices(org_id, body: nil) ⇒ ApiResponse
This mirrors ‘POST /api/v1/orgs/org_id/inventory` (see Inventory API) here
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/mist_api/controllers/installer.rb', line 146 def claim_installer_devices(org_id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/v1/installer/orgs/{org_id}/devices', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ResponseInventory.method(:from_hash)) .is_api_response(true) .local_error('400', 'OK - if any of entries are valid or there’s no errors', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#create_installer_map(org_id, site_name, map_id, body: nil) ⇒ ApiResponse
Create a MAP here here here
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
# File 'lib/mist_api/controllers/installer.rb', line 1003 def create_installer_map(org_id, site_name, map_id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/v1/installer/orgs/{org_id}/sites/{site_name}/maps/{map_id}', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(site_name, key: 'site_name') .should_encode(true)) .template_param(new_parameter(map_id, key: 'map_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Map.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#create_installer_virtual_chassis(org_id, fpc0_mac, body: nil) ⇒ ApiResponse
For models (e.g. EX3400 and up) having dedicated VC ports, it is easier to form a VC by just connecting cables with the dedicated VC ports. Cloud will detect the new VC and update the inventory. In case that the user would like to choose the dedicated switch as a VC master or for EX2300-C-12P and EX2300-C-12T which doesn’t have dedicated VC ports, below are procedures to automate the VC creation:
-
Power on the switch that is chosen as the VC master first. And then
powering on the other member switches.
-
Claim or adopt all these switches under the same organization’s
Inventory
-
Assign these switches into the same Site
-
Invoke vc command on the switch chosen to be the VC master. For
EX2300-C-12P, VC ports will be created automatically.
-
Connect the cables to the VC ports for these switches
-
Wait for the VC to be formed. The Org’s inventory will be updated for
the new VC. here
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
# File 'lib/mist_api/controllers/installer.rb', line 531 def create_installer_virtual_chassis(org_id, fpc0_mac, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/v1/installer/orgs/{org_id}/devices/{fpc0_mac}/vc', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(fpc0_mac, key: 'fpc0_mac') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ResponseVirtualChassisConfig.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#create_or_update_installer_sites(org_id, site_name, body: nil) ⇒ ApiResponse
Often the Installers are asked to assign Devices to Sites. The Sites can either be pre-created or created/modified by the Installer. If this is an update, the same grace period also applies. here here
805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 |
# File 'lib/mist_api/controllers/installer.rb', line 805 def create_or_update_installer_sites(org_id, site_name, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/api/v1/installer/orgs/{org_id}/sites/{site_name}', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(site_name, key: 'site_name') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .is_response_void(true) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#delete_installer_device_image(org_id, image_name, device_mac) ⇒ ApiResponse
Delete image here here here
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/mist_api/controllers/installer.rb', line 366 def delete_installer_device_image(org_id, image_name, device_mac) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/api/v1/installer/orgs/{org_id}/devices/{device_mac}/{image_name}', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(image_name, key: 'image_name') .should_encode(true)) .template_param(new_parameter(device_mac, key: 'device_mac') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .is_response_void(true) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#delete_installer_map(org_id, site_name, map_id) ⇒ ApiResponse
Delete Map here here here
956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 |
# File 'lib/mist_api/controllers/installer.rb', line 956 def delete_installer_map(org_id, site_name, map_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/api/v1/installer/orgs/{org_id}/sites/{site_name}/maps/{map_id}', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(site_name, key: 'site_name') .should_encode(true)) .template_param(new_parameter(map_id, key: 'map_id') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .is_response_void(true) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#get_installer_device_virtual_chassis(org_id, fpc0_mac) ⇒ ApiResponse
Get VC Status The API returns a combined view of the VC status which includes topology and stats here
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
# File 'lib/mist_api/controllers/installer.rb', line 474 def get_installer_device_virtual_chassis(org_id, fpc0_mac) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/installer/orgs/{org_id}/devices/{fpc0_mac}/vc', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(fpc0_mac, key: 'fpc0_mac') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ResponseVirtualChassisConfig.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#import_installer_map(org_id, site_name, auto_deviceprofile_assignment: nil, csv: nil, file: nil, json: nil) ⇒ ApiResponse
Import data from files is a multipart POST which has an file, an optional json, and an optional csv, to create floorplan, assign & place ap if name or mac matches here here parameter: Whether to auto assign device to deviceprofile by name mapping, optional here
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 |
# File 'lib/mist_api/controllers/installer.rb', line 902 def import_installer_map(org_id, site_name, auto_deviceprofile_assignment: nil, csv: nil, file: nil, json: nil) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/v1/installer/orgs/{org_id}/sites/{site_name}/maps/import', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(site_name, key: 'site_name') .should_encode(true)) .form_param(new_parameter(auto_deviceprofile_assignment, key: 'auto_deviceprofile_assignment')) .multipart_param(new_parameter(csv, key: 'csv') .default_content_type('application/octet-stream')) .multipart_param(new_parameter(file, key: 'file') .default_content_type('application/octet-stream')) .form_param(new_parameter(json, key: 'json')) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ResponseMapImport.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#list_installer_alarm_templates(org_id) ⇒ ApiResponse
Get List of alarm templates here
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/mist_api/controllers/installer.rb', line 13 def list_installer_alarm_templates(org_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/installer/orgs/{org_id}/alarmtemplates', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InstallersItem.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#list_installer_device_profiles(org_id, type: DeviceTypeDefaultApEnum::AP) ⇒ ApiResponse
Get List of Device Profiles here
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/mist_api/controllers/installer.rb', line 52 def list_installer_device_profiles(org_id, type: DeviceTypeDefaultApEnum::AP) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/installer/orgs/{org_id}/deviceprofiles', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .query_param(new_parameter(type, key: 'type')) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InstallersItem.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#list_installer_list_of_recently_claimed_devices(org_id, model: nil, site_name: nil, site_id: nil, limit: 100, page: 1) ⇒ ApiResponse
Get List of recently claimed devices here
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/mist_api/controllers/installer.rb', line 97 def list_installer_list_of_recently_claimed_devices(org_id, model: nil, site_name: nil, site_id: nil, limit: 100, page: 1) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/installer/orgs/{org_id}/devices', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .query_param(new_parameter(model, key: 'model')) .query_param(new_parameter(site_name, key: 'site_name')) .query_param(new_parameter(site_id, key: 'site_id')) .query_param(new_parameter(limit, key: 'limit')) .query_param(new_parameter(page, key: 'page')) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InstallerDevice.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#list_installer_maps(org_id, site_name) ⇒ ApiResponse
Get List of Maps here here
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 |
# File 'lib/mist_api/controllers/installer.rb', line 850 def list_installer_maps(org_id, site_name) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/installer/orgs/{org_id}/sites/{site_name}/maps', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(site_name, key: 'site_name') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Map.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#list_installer_rf_templates_names(org_id) ⇒ ApiResponse
Get List of RF Templates here
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 |
# File 'lib/mist_api/controllers/installer.rb', line 686 def list_installer_rf_templates_names(org_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/installer/orgs/{org_id}/rftemplates', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InstallersItem.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#list_installer_site_groups(org_id) ⇒ ApiResponse
Get List of Site Groups here
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 |
# File 'lib/mist_api/controllers/installer.rb', line 724 def list_installer_site_groups(org_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/installer/orgs/{org_id}/sitegroups', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InstallersItem.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#list_installer_sites(org_id) ⇒ ApiResponse
Get List of Sites here
762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
# File 'lib/mist_api/controllers/installer.rb', line 762 def list_installer_sites(org_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/installer/orgs/{org_id}/sites', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(InstallerSite.method(:from_hash)) .is_api_response(true) .is_response_array(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#optimize_installer_rrm(site_name) ⇒ ApiResponse
After installation is considered complete (APs are placed on maps, all powered up), you can trigger an optimize operation where RRM will kick in (and maybe other things in the future) before it’s automatically scheduled. here
1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 |
# File 'lib/mist_api/controllers/installer.rb', line 1105 def optimize_installer_rrm(site_name) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/api/v1/installer/sites/{site_name}/optimize', Server::API_HOST) .template_param(new_parameter(site_name, key: 'site_name') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .is_response_void(true) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#provision_installer_devices(org_id, device_mac, body: nil) ⇒ ApiResponse
Provision or Replace a device If replacing_mac is in the request payload, other attributes are ignored, we attempt to replace existing device (with mac replacing_mac) with the inventory device being configured. The replacement device must be in the inventory but not assigned, and the replacing_mac device must be assigned to a site, and satisfy grace period requirements. The Device replaced will become unassigned. here here
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
# File 'lib/mist_api/controllers/installer.rb', line 237 def provision_installer_devices(org_id, device_mac, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/api/v1/installer/orgs/{org_id}/devices/{device_mac}', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(device_mac, key: 'device_mac') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .is_response_void(true) .is_api_response(true) .local_error('400', 'Bad Request', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not Found', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#start_installer_locate_device(org_id, device_mac) ⇒ ApiResponse
Locate a Device by blinking it’s LED, it’s a persisted state that has to be stopped by calling Stop Locating API here here
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/mist_api/controllers/installer.rb', line 282 def start_installer_locate_device(org_id, device_mac) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/v1/installer/orgs/{org_id}/devices/{device_mac}/locate', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(device_mac, key: 'device_mac') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .is_response_void(true) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#stop_installer_locate_device(org_id, device_mac) ⇒ ApiResponse
Stop it here here
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/mist_api/controllers/installer.rb', line 323 def stop_installer_locate_device(org_id, device_mac) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/api/v1/installer/orgs/{org_id}/devices/{device_mac}/unlocate', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(device_mac, key: 'device_mac') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .is_response_void(true) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#unassign_installer_recently_claimed_device(org_id, device_mac) ⇒ ApiResponse
Unassign recently claimed devices here here
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/mist_api/controllers/installer.rb', line 189 def unassign_installer_recently_claimed_device(org_id, device_mac) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/api/v1/installer/orgs/{org_id}/devices/{device_mac}', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(device_mac, key: 'device_mac') .should_encode(true)) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .is_response_void(true) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#update_installer_map(org_id, site_name, map_id, body: nil) ⇒ ApiResponse
Update map here here here
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 |
# File 'lib/mist_api/controllers/installer.rb', line 1055 def update_installer_map(org_id, site_name, map_id, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/api/v1/installer/orgs/{org_id}/sites/{site_name}/maps/{map_id}', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(site_name, key: 'site_name') .should_encode(true)) .template_param(new_parameter(map_id, key: 'map_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(Map.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |
#update_installer_virtual_chassis_member(org_id, fpc0_mac, body: nil) ⇒ ApiResponse
The VC creation and adding member switch API will update the device’ s virtual chassis config which is applied after VC is formed to create JUNOS pre-provisioned virtual chassis configuration. ## Change to use preprovisioned VC To switch the VC to use preprovisioned VC, enable preprovisioned in virtual_chassis config. Both vc_role master and backup will be matched to routing-engine role in Junos preprovisioned VC config. In this config, fpc0 has to be the same as the mac of device_id. Use renumber if you want to replace fpc0 which involves device_id change. Notice: to configure preprovisioned VC, every member of the VC must be in the inventory. ## Add new members For models (e.g. EX4300 and up) having dedicated VC ports, it is easier to add new member switches into a VC by just connecting cables with the dedicated VC ports. Cloud will detect the new members and update the inventory. For EX2300 VC, adding new members requires to follow the procedures below:
-
Powering on the new member switches and ensuring cables are not
connected to any VC ports.
-
Claim or adopt all new member switches under the VC’s organization
Inventory
-
Assign all new member switches to the same Site as the VC
-
Invoke vc command to add switches to the VC.
-
Connect the cables to the VC ports for these switches
-
After a while, the Org’s Inventory shows this new switches has been
added into the VC. ## Removing member switch To remove a member switch from the VC, following the procedures below:
-
Ensuring the VC is connected to the cloud first
-
Unplug the cable from the VC port of the switch
-
Waiting for the VC state (vc_state) of this switch is changed to
not-present
-
Invoke update_vc with remove to remove this switch from the VC
-
The Org’s Inventory shows the switch is removed.
Please notice that member ID 0 (fpc0) cannot be removed. When a VC has two switches left, unplugging the cable may result in the situation that fpc0 becomes a line card (LC). When this situation is happening, please re-plug in the cable, wait for both switches becoming present (show virtual-chassis) and then removing the cable again. ## Renumber a member switch When a member switch doesn’t’ work properly and needed to be replaced, the renumber API could be used. The following two types of renumber are supported:
-
Replace a non-fpc0 member switch
-
Replace fpc0. When fpc0 is replaced, PAPI device config and JUNOS
config will be both updated. For renumber to work, the following procedures are needed:
-
Ensuring the VC is connected to the cloud and the state of the member
switch to be replaced must be non present.
-
Adding the new member switch to the VC
-
Waiting for the VC state (vc_state) of this VC to be updated to API
server
-
Invoke vc with renumber to replace the new member switch from fpc X to
## Perprovision VC members By specifying “preprovision” op, you can convert the current VC to pre-provisioned mode, update VC members as well as specify vc_ports when adding new members for device models without dedicated vc ports. Use renumber for fpc0 replacement which involves device_id change. Note:
-
vc_ports is used for adding new members and not needed if * the device
model has dedicated vc ports, or * no new member is added
-
New VC members to be added should exist in the same Site as the VC
Update Device’s VC config can achieve similar purpose by directly modifying current virtual_chassis config. However, it cannot fulfill requests to enabling vc_ports on new members that are yet to belong to current VC. here
642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 |
# File 'lib/mist_api/controllers/installer.rb', line 642 def update_installer_virtual_chassis_member(org_id, fpc0_mac, body: nil) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/api/v1/installer/orgs/{org_id}/devices/{fpc0_mac}/vc', Server::API_HOST) .template_param(new_parameter(org_id, key: 'org_id') .should_encode(true)) .template_param(new_parameter(fpc0_mac, key: 'fpc0_mac') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Or.new('apiToken', 'basicAuth', And.new('basicAuth', 'csrfToken')))) .response(new_response_handler .is_nullify404(true) .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ResponseVirtualChassisConfig.method(:from_hash)) .is_api_response(true) .local_error('400', 'Bad Syntax', APIException) .local_error('401', 'Unauthorized', APIException) .local_error('403', 'Permission Denied', APIException) .local_error('404', 'Not found. The API endpoint doesn’t exist or resource doesn’ t'\ ' exist', APIException) .local_error('429', 'Too Many Request. The API Token used for the request reached'\ ' the 5000 API Calls per hour threshold', APIException)) .execute end |