This documentation is for WSO2 Private PaaS 4.1.0. View documentation for the latest release.
Adding a Network Partition - WSO2 Private PaaS 4.1.0 - WSO2 Documentation
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
||
Skip to end of metadata
Go to start of metadata

You can add a network partition using the CLI tool, REST API or the PPaaS Console as shown below:

 

Adding a network partition via the CLI

Overview
CLI command

add-network-partition

DescriptionAdd a new network partition.
Command format
add-network-partition -p <JSON_FILE_PATH>

The path to the JSON file that defines the network partition needs to be defined as the <JSON_FILE_PATH> value.

Parameter definition
Short optionLong optionDescriptionRequiredExample value
-p
--resource-pathFolder path where the JSON file that defines the network partition is stored.yes <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples
/network-partitions/mock/network-partition-mock.json
Example

Add the network partition that has been defined in the <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/network-partitions/mock/network-partition-mock.json file.

add-network-partition -p <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/network-partitions/mock/network-partition-mock.json
Sample output
Network partition added successfully: [network-partition] network-partition-mock

Adding a network partition via the REST API

Overview
DescriptionAdd a network partition.
URL/networkPartitions
HTTP MethodPOST
Request/Response Formatapplication/json
Command format
curl -X POST -H "Content-Type: application/json" -d "@<JSON_PAYLOAD>" -k -v -u <USERNAME>:<PASSWORD> https://<PRIVATE_PAAS_HOST>:<PRIVATE_PAAS_HTTPS_PORT>/api/networkPartitions
  • The path to the JSON file that defines the network partition needs to be defined as the <JSON_PAYLOAD> value.
  • By default, <USERNAME>:<PASSWORD> is admin:admin.
  • By default, <PRIVATE_PAAS_HOST> is localhost. However, if you are using a public IP, the respective IP address or domain needs to be specified.
  • By default, <PRIVATE_PAAS_HTTPS_PORT> has been set to 9443. However, if the port offset has been incremented by n, the default port value needs to be incremented by n.
Example

Add the network partition that has been defined in the <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/network-partitions/mock/network-partition-mock.json file.

cd <PRIVATE_PAAS_CARTRIDGES>/wso2am/1.9.0/samples/
curl -X POST -H "Content-Type: application/json" -d @'network-partitions/mock/network-partition-mock.json' -k -v -u admin:admin https://localhost:9443/api/networkPartitions
Sample output
> POST /api/networkPartitions HTTP/1.1
> Host: localhost:9443
> Authorization: Basic YWRtaW46YWRtaW4=
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 476
> 
< HTTP/1.1 201 Created
< Date: Fri, 02 Oct 2015 06:11:43 GMT
< Location: https://localhost:9443/api/networkPartitions/network-partition-mock
< Content-Type: application/json
< Transfer-Encoding: chunked
< Server: WSO2 Carbon Server
< 
{"status":"success","message":"Network partition added successfully: [network-partition] network-partition-mock"}

You will come across the following HTTP status codes while adding a network partition:

HTTP status code

201, 400, 409, 500

See the descriptions of the HTTP status codes here.

Location header URL https://<STRATOS_HOST>:<PORT>/api/networkPartitions/<NETWORK_PARTITION_ID>

Adding a network partition via the PPaaS Console

Adding a network partition via the UI editor

Follow the instructions below to add a network partition:

  1. Click Configurations on the home page.
  2. Click Network Partitions. The Network Partition Definitions page will appear.
  3. Click ADD NETWORK PARTITION.
  4. Enter the required details. For property definitions, see Network Partition Resource Definition.

    1. To define properties of items.
      1. Click Properties next to the respective item you wish to define.
        Example: Partition 1
      2. Select the property fields that you wish to set at the property level.
      3. Optionally, if you wish to add a customized property at the property level, enter the property name and click +add  to add it.
  5. Click SAVE NETWORK PARTITION DEFINITION.
     

Adding a network partition via the JSON editor

Follow the instructions below to add a network partition:

  1. Click Configurations on the home page.
  2. Click Network Partitions. The Network Partition Definitions page will appear.
  3. Click ADD NETWORK PARTITION. The form to add a new partition definition will appear in the UI editor.
  4. Click on the editor control to switch to the JSON editor. The JSON code format to add a network partition will appear.
  5. Optionally, check the Auto correct with schema option to ensure that you do not accidentally delete any mandatory fields from the network partition definition JSON code.
  6. Code the network partition definition using JSON. For property definitions, see the Network Partition Resource Definition.
  7. Click SAVE NETWORK PARTITION DEFINITION.

 


Sample network partition JSON

{ 
   "id":"network-partition-1",
   "provider":"ec2",
   "partitions":[ 
      { 
         "id":"partition-1",
         "property":[ 
            { 
               "name":"region",
               "value":"default"
            }
         ]
      }
   ]
}
{
  "id": "network-partition-1",
  "provider": "mock",
  "partitions": [
    {
      "id": "partition-1",
      "property": [
        {
          "name": "region",
          "value": "default"
        }
      ]
    }
  ]
}
{ 
   "id":"network-partition-1",
   "provider":"kubernetes",
   "partitions":[ 
      { 
         "id":"partition-1",
         "property":[ 
            { 
               "name":"cluster",
               "value":"kubernetes-cluster-1"
            }
         ]
      }
   ]
}
  • No labels