This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.devcontainer/devcontainer.json: | |
{ | |
"name": "AsBuiltReport.VMware.NSX-T Development Container", | |
"dockerFile": "Dockerfile", | |
"postCreateCommand": "pwsh", | |
"extensions": [ | |
"ms-vscode.powershell" | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<array> | |
<dict> | |
<key>Activate</key> | |
<string>Normal</string> | |
<key>CreationDate</key> | |
<real>604609311.14479399</real> | |
<key>Macros</key> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# this script randomly scales 1 deployment per namespace per cluster (for demo purposes) | |
# | |
# 2019 Martijn Smit <msmit@vmware.com> | |
cluster_list=("k8s-cluster-1" "k8s-cluster-2") | |
for cluster in "${cluster_list[@]}" | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Edit this | |
$NSXT_Manager = "your-nsxt-manager-hostname-or-ip" | |
$NSXT_Username = "admin" | |
$NSXT_Password = 'mypassword' | |
# Stop editing | |
function Invoke-NSXTRestMethod | |
{ | |
param ( | |
[Parameter (Mandatory=$true)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import init_api_client | |
import swagger_client | |
from swagger_client.rest import ApiException | |
# Initialize SDK and parse the args for connection details | |
args = init_api_client.parse_arguments() | |
api_client = init_api_client.get_api_client(args) | |
# Create search API client object | |
search_api = swagger_client.SearchApi() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import swagger_client | |
from swagger_client.rest import ApiException | |
api_client = swagger_client.ApiClient(host="https://{}/api/ni".format("my-vrni-platform-fdqn-or-ip")) | |
user_creds = swagger_client.UserCredential(username="admin@local", password="VMware1!", domain=dict(domain_type="LOCAL")) | |
auth_api = swagger_client.AuthenticationApi(api_client=api_client) | |
auth_token = auth_api.create(user_creds) | |
print(auth_token) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IMPORTANT: This needs to be your vRA host. In my case it happened to the third server configured. | |
// there is probably a better way to handle this. | |
var vraHost = Server.findAllForType("vCACCAFE:VCACHost")[3]; | |
// save the catalogRequestId from the payload given by vRA | |
var requestId = payload.get("catalogRequestId"); | |
// create a REST client on the selected vRA host, which we can use to do API calls against | |
var client = vraHost.createCatalogClient(); | |
// get the resources (read: VMs) that are a part of the catalogRequestId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This snippet gets all the IP routes | |
# | |
# Import-Module PowerNSX and run | |
# Connect-NsxServer before running this. | |
$edges = Get-NsxEdge | |
foreach($edge in $edges) | |
{ | |
Write-Host "Getting routes for Edge $($edge.name) ($($edge.id))" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-NsxMulticastRange | |
{ | |
<# | |
.SYNOPSIS | |
Adds a new multicast IP address range for use in the VXLAN network | |
.DESCRIPTION | |
Specifying a multicast address range helps in spreading traffic across your | |
network to avoid overloading a single multicast address.A virtualized | |
network‐ready host is assigned an IP address from this range. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param ( | |
[parameter(Mandatory=$true,ValueFromPipeLine=$true,ValueFromPipeLineByPropertyName=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$username, | |
[parameter(Mandatory=$true,ValueFromPipeLine=$true,ValueFromPipeLineByPropertyName=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$password, | |
[parameter(Mandatory=$true,ValueFromPipeLine=$true,ValueFromPipeLineByPropertyName=$true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$apic, |