summaryrefslogtreecommitdiffstats
path: root/verigraph/src/main/java/it/polito/escape/verify/model
diff options
context:
space:
mode:
Diffstat (limited to 'verigraph/src/main/java/it/polito/escape/verify/model')
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Configuration.java75
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Entry.java37
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/ErrorMessage.java62
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Graph.java105
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Link.java71
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Neighbour.java70
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Node.java152
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Test.java62
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Verification.java69
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/jaxb.properties1
10 files changed, 704 insertions, 0 deletions
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Configuration.java b/verigraph/src/main/java/it/polito/escape/verify/model/Configuration.java
new file mode 100644
index 0000000..3498a10
--- /dev/null
+++ b/verigraph/src/main/java/it/polito/escape/verify/model/Configuration.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Politecnico di Torino and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Apache License, Version 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *******************************************************************************/
+
+package it.polito.escape.verify.model;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import it.polito.escape.verify.deserializer.ConfigurationCustomDeserializer;
+import it.polito.escape.verify.serializer.CustomConfigurationSerializer;
+
+@XmlRootElement
+@ApiModel("Configuration")
+@JsonSerialize(using = CustomConfigurationSerializer.class)
+@JsonDeserialize(using = ConfigurationCustomDeserializer.class)
+public class Configuration {
+
+ @ApiModelProperty(required = false, hidden = true)
+ @XmlTransient
+ private String id;
+
+ @ApiModelProperty(required = false)
+ @XmlTransient
+ private String description = "";
+
+ @ApiModelProperty(required = true)
+ private JsonNode configuration;
+
+ }
#!/bin/bash
##############################################################################
# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
rsa_file=$compass_vm_dir/boot.rsa

function rename_nics(){
    python $COMPASS_DIR/deploy/rename_nics.py $DHA $rsa_file $INSTALL_IP $OS_VERSION
}

function add_bonding(){
    python $COMPASS_DIR/deploy/bonding.py $NETWORK $rsa_file $INSTALL_IP
}

function deploy_host(){
    export AYNC_TIMEOUT=20

    # avoid nodes reboot to fast, cobbler can not give response
    (sleep $AYNC_TIMEOUT; add_bonding; rename_nics; reboot_hosts) &
    if [[ "$REDEPLOY_HOST" == true ]]; then
        deploy_flag="redeploy"
    else
        deploy_flag="deploy"
    fi

    python ${COMPASS_DIR}/deploy/client.py --deploy_flag=$deploy_flag --compass_server="${HTTP_SERVER_URL}" \
    --compass_user_email="${COMPASS_USER_EMAIL}" --compass_user_password="${COMPASS_USER_PASSWORD}" \
    --cluster_name="${CLUSTER_NAME}" --language="${LANGUAGE}" --timezone="${TIMEZONE}" \
    --hostnames="${HOSTNAMES}" --partitions="${PARTITIONS}" --subnets="${SUBNETS}" \
    --adapter_os_pattern="${ADAPTER_OS_PATTERN}" --adapter_name="${ADAPTER_NAME}" \
    --adapter_target_system_pattern="${ADAPTER_TARGET_SYSTEM_PATTERN}" \
    --adapter_flavor_pattern="${ADAPTER_FLAVOR_PATTERN}" --repo_name="${REPO_NAME}" \
    --http_proxy="${PROXY}" --https_proxy="${PROXY}" --no_proxy="${IGNORE_PROXY}" \
    --ntp_server="${NTP_SERVER}" --dns_servers="${NAMESERVERS}" --domain="${DOMAIN}" \
    --search_path="${SEARCH_PATH}" --default_gateway="${INSTALL_GW}" \
    --server_credential="${SERVER_CREDENTIAL}" --local_repo_url="${LOCAL_REPO_URL}" \
    --os_config_json_file="${OS_CONFIG_FILENAME}" --service_credentials="${SERVICE_CREDENTIALS}" \
    --console_credentials="${CONSOLE_CREDENTIALS}" --host_networks="${HOST_NETWORKS}" \
    --network_mapping="${NETWORK_MAPPING}" --package_config_json_file="${PACKAGE_CONFIG_FILENAME}" \
    --host_roles="${HOST_ROLES}" --default_roles="${DEFAULT_ROLES}" --switch_ips="${SWITCH_IPS}" \
    --machines=${machines//\'} --switch_credential="${SWITCH_CREDENTIAL}" --deploy_type="${TYPE}" \
    --deployment_timeout="${DEPLOYMENT_TIMEOUT}" --${POLL_SWITCHES_FLAG} --dashboard_url="${DASHBOARD_URL}" \
    --cluster_vip="${VIP}" --network_cfg="$NETWORK" --neutron_cfg="$NEUTRON" \
    --enable_secgroup="${ENABLE_SECGROUP}" --enable_fwaas="${ENABLE_FWAAS}" --expansion="${EXPANSION}" \
    --rsa_file="$rsa_file" --enable_vpnaas
+public class Link {
+ @ApiModelProperty(required = false, hidden = true)
+ private String link;
+ @ApiModelProperty(required = false, hidden = true)
+ private String rel;
+
+ public String getLink() {
+ return link;
+ }
+
+ public void setLink(String link) {
+ this.link = link;
+ }
+
+ public String getRel() {
+ return rel;
+ }
+
+ public void setRel(String rel) {
+ this.rel = rel;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((link == null) ? 0 : link.hashCode());
+ result = prime * result + ((rel == null) ? 0 : rel.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Link other = (Link) obj;
+ if (link == null) {
+ if (other.link != null)
+ return false;
+ }
+ else if (!link.equals(other.link))
+ return false;
+ if (rel == null) {
+ if (other.rel != null)
+ return false;
+ }
+ else if (!rel.equals(other.rel))
+ return false;
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Neighbour.java b/verigraph/src/main/java/it/polito/escape/verify/model/Neighbour.java
new file mode 100644
index 0000000..4b1206c
--- /dev/null
+++ b/verigraph/src/main/java/it/polito/escape/verify/model/Neighbour.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Politecnico di Torino and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Apache License, Version 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *******************************************************************************/
+
+package it.polito.escape.verify.model;
+
+import javax.xml.bind.annotation.XmlTransient;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel(value = "Neighbour")
+public class Neighbour {
+
+ @ApiModelProperty(required = false, hidden = true)
+ @XmlTransient
+ private long id;
+
+ @ApiModelProperty( required = true,
+ example = "nat",
+ value = "The neighbour name must refer to an existing node of the same graph")
+ private String name;
+
+ public Neighbour() {
+
+ }
+
+ public Neighbour(long id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ else
+ return false;
+ }
+
+}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Node.java b/verigraph/src/main/java/it/polito/escape/verify/model/Node.java
new file mode 100644
index 0000000..9f667ce
--- /dev/null
+++ b/verigraph/src/main/java/it/polito/escape/verify/model/Node.java
@@ -0,0 +1,152 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Politecnico di Torino and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Apache License, Version 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *******************************************************************************/
+
+package it.polito.escape.verify.model;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import it.polito.escape.verify.deserializer.NodeCustomDeserializer;
+import it.polito.escape.verify.serializer.CustomMapSerializer;
+
+@ApiModel(value = "Node")
+@XmlRootElement
+@JsonDeserialize(using = NodeCustomDeserializer.class)
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+public class Node {
+
+ @ApiModelProperty(required = false, hidden = true)
+ @XmlTransient
+ private long id;
+
+ @ApiModelProperty(required = true, example = "ep", value = "The name of the node can be any string")
+ private String name;
+
+ @ApiModelProperty( required = true,
+ example = "endpoint",
+ value = "The functional types that are currently supported are: endpoint, firewall, nat, antispam, webclient, webserver, mailclient, mailserver")
+ private String functional_type;
+
+ @ApiModelProperty(required = false, hidden = true)
+ @XmlTransient
+ private Configuration configuration = new Configuration();
+
+ @ApiModelProperty( name = "neighbours",
+ notes = "Neighbours",
+ dataType = "List[it.polito.escape.verify.model.Neighbour]")
+ private Map<Long, Neighbour> neighbours = new HashMap<Long, Neighbour>();
+
+ @ApiModelProperty(required = false, hidden = true)
+ @XmlTransient
+ private Set<Link> links = new HashSet<>();
+
+ public Node() {
+
+ }
+
+ public Node(long id, String name, String functional_type, Configuration configuration) {
+ this.id = id;
+ this.name = name;
+ this.functional_type = functional_type;
+ this.configuration = configuration;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getFunctional_type() {
+ return functional_type;
+ }
+
+ public void setFunctional_type(String functional_type) {
+ this.functional_type = functional_type;
+ }
+
+ // @XmlTransient
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
+
+ @JsonSerialize(using = CustomMapSerializer.class)
+ public Map<Long, Neighbour> getNeighbours() {
+ return neighbours;
+ }
+
+ public void setNeighbours(Map<Long, Neighbour> neighbours) {
+ this.neighbours = neighbours;
+ }
+
+ public long getId() {
+ return this.id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public Set<Link> getLinks() {
+ return links;
+ }
+
+ public void setLinks(Set<Link> links) {
+ this.links = links;
+ }
+
+ public void addLink(String url, String rel) {
+ Link link = new Link();
+ link.setLink(url);
+ link.setRel(rel);
+ links.add(link);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ else
+ return false;
+ }
+
+ public Neighbour searchNeighbourByName(String name) {
+ for (Neighbour neighbour : this.neighbours.values()) {
+ if (neighbour.getName().equals(name))
+ return neighbour;
+ }
+ return null;
+ }
+
+}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Test.java b/verigraph/src/main/java/it/polito/escape/verify/model/Test.java
new file mode 100644
index 0000000..1127abc
--- /dev/null
+++ b/verigraph/src/main/java/it/polito/escape/verify/model/Test.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Politecnico di Torino and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Apache License, Version 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *******************************************************************************/
+
+package it.polito.escape.verify.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Test {
+ private List<Node> nodes = new ArrayList<Node>();
+ private String result;
+
+ public Test() {
+
+ }
+
+ public Test(List<Node> paths, int result) {
+ switch (result) {
+ case 0:
+ this.result = "SAT";
+ break;
+ case -1:
+ this.result = "UNSAT";
+ break;
+ case -2:
+ this.result = "UNKNOWN";
+ break;
+ default:
+ this.result = "UNKNWON";
+ break;
+ }
+ this.nodes = paths;
+ }
+
+ public Test(List<Node> paths, String result) {
+ this.nodes = paths;
+ this.result = result;
+ }
+
+ public List<Node> getPath() {
+ return nodes;
+ }
+
+ public void setPath(List<Node> paths) {
+ this.nodes = paths;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Verification.java b/verigraph/src/main/java/it/polito/escape/verify/model/Verification.java
new file mode 100644
index 0000000..60b4ddb
--- /dev/null
+++ b/verigraph/src/main/java/it/polito/escape/verify/model/Verification.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Politecnico di Torino and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Apache License, Version 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *******************************************************************************/
+
+package it.polito.escape.verify.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+@ApiModel(value = "Policy verification")
+public class Verification {
+
+ @ApiModelProperty(example = "SAT | UNSAT | UNKNOWN")
+ private String result;
+ private String comment;
+ private List<Test> tests = new ArrayList<Test>();
+
+ public Verification() {
+
+ }
+
+ public Verification(String result) {
+ this.result = result;
+ }
+
+ public Verification(String result, List<Test> tests, String comment){
+ this.result = result;
+ this.tests = tests;
+ this.comment = comment;
+ }
+
+ public Verification(String result, String comment){
+ this.result = result;
+ this.comment = comment;
+ }
+
+ public String getResult() {
+ return result;
+ }
+
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+ public List<Test> getTests() {
+ return tests;
+ }
+
+ public void setTests(List<Test> tests) {
+ this.tests = tests;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/jaxb.properties b/verigraph/src/main/java/it/polito/escape/verify/model/jaxb.properties
new file mode 100644
index 0000000..5837a4c
--- /dev/null
+++ b/verigraph/src/main/java/it/polito/escape/verify/model/jaxb.properties
@@ -0,0 +1 @@
+javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file