Commit a0200afa authored by fsoldatos's avatar fsoldatos
Browse files

fix(automation): minor fixes for automation component

parent 0bf921fb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ message DeviceRoleState {
}

message DeviceDeletionResult {
  repeated bool deleted = 1;
  repeated string deleted = 1;
}

message Empty {}
+3 −1
Original line number Diff line number Diff line
# How to run locally the automation service (tested in Ubuntu 20.04)
# Automation TeraFlow OS service 

The Automation service, also known as Zero-Touch Provisioning (ZTP), is tested on Ubuntu 20.04. Follow the instructions below to build, test, and run this service on your local environment.


## Compile code
+96 −70
Original line number Diff line number Diff line
@@ -3344,21 +3344,29 @@ public final class Automation {
      com.google.protobuf.MessageOrBuilder {

    /**
     * <code>repeated bool deleted = 1;</code>
     * <code>repeated string deleted = 1;</code>
     * @return A list containing the deleted.
     */
    java.util.List<java.lang.Boolean> getDeletedList();
    java.util.List<java.lang.String>
        getDeletedList();
    /**
     * <code>repeated bool deleted = 1;</code>
     * <code>repeated string deleted = 1;</code>
     * @return The count of deleted.
     */
    int getDeletedCount();
    /**
     * <code>repeated bool deleted = 1;</code>
     * <code>repeated string deleted = 1;</code>
     * @param index The index of the element to return.
     * @return The deleted at the given index.
     */
    boolean getDeleted(int index);
    java.lang.String getDeleted(int index);
    /**
     * <code>repeated string deleted = 1;</code>
     * @param index The index of the value to return.
     * @return The bytes of the deleted at the given index.
     */
    com.google.protobuf.ByteString
        getDeletedBytes(int index);
  }
  /**
   * Protobuf type {@code automation.DeviceDeletionResult}
@@ -3373,7 +3381,7 @@ public final class Automation {
      super(builder);
    }
    private DeviceDeletionResult() {
      deleted_ = emptyBooleanList();
      deleted_ = com.google.protobuf.LazyStringArrayList.EMPTY;
    }

    @java.lang.Override
@@ -3407,25 +3415,13 @@ public final class Automation {
            case 0:
              done = true;
              break;
            case 8: {
              if (!((mutable_bitField0_ & 0x00000001) != 0)) {
                deleted_ = newBooleanList();
                mutable_bitField0_ |= 0x00000001;
              }
              deleted_.addBoolean(input.readBool());
              break;
            }
            case 10: {
              int length = input.readRawVarint32();
              int limit = input.pushLimit(length);
              if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) {
                deleted_ = newBooleanList();
              java.lang.String s = input.readStringRequireUtf8();
              if (!((mutable_bitField0_ & 0x00000001) != 0)) {
                deleted_ = new com.google.protobuf.LazyStringArrayList();
                mutable_bitField0_ |= 0x00000001;
              }
              while (input.getBytesUntilLimit() > 0) {
                deleted_.addBoolean(input.readBool());
              }
              input.popLimit(limit);
              deleted_.add(s);
              break;
            }
            default: {
@@ -3444,7 +3440,7 @@ public final class Automation {
            e).setUnfinishedMessage(this);
      } finally {
        if (((mutable_bitField0_ & 0x00000001) != 0)) {
          deleted_.makeImmutable(); // C
          deleted_ = deleted_.getUnmodifiableView();
        }
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
@@ -3464,32 +3460,39 @@ public final class Automation {
    }

    public static final int DELETED_FIELD_NUMBER = 1;
    private com.google.protobuf.Internal.BooleanList deleted_;
    private com.google.protobuf.LazyStringList deleted_;
    /**
     * <code>repeated bool deleted = 1;</code>
     * <code>repeated string deleted = 1;</code>
     * @return A list containing the deleted.
     */
    @java.lang.Override
    public java.util.List<java.lang.Boolean>
    public com.google.protobuf.ProtocolStringList
        getDeletedList() {
      return deleted_;
    }
    /**
     * <code>repeated bool deleted = 1;</code>
     * <code>repeated string deleted = 1;</code>
     * @return The count of deleted.
     */
    public int getDeletedCount() {
      return deleted_.size();
    }
    /**
     * <code>repeated bool deleted = 1;</code>
     * <code>repeated string deleted = 1;</code>
     * @param index The index of the element to return.
     * @return The deleted at the given index.
     */
    public boolean getDeleted(int index) {
      return deleted_.getBoolean(index);
    public java.lang.String getDeleted(int index) {
      return deleted_.get(index);
    }
    /**
     * <code>repeated string deleted = 1;</code>
     * @param index The index of the value to return.
     * @return The bytes of the deleted at the given index.
     */
    public com.google.protobuf.ByteString
        getDeletedBytes(int index) {
      return deleted_.getByteString(index);
    }
    private int deletedMemoizedSerializedSize = -1;

    private byte memoizedIsInitialized = -1;
    @java.lang.Override
@@ -3505,13 +3508,8 @@ public final class Automation {
    @java.lang.Override
    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (getDeletedList().size() > 0) {
        output.writeUInt32NoTag(10);
        output.writeUInt32NoTag(deletedMemoizedSerializedSize);
      }
      for (int i = 0; i < deleted_.size(); i++) {
        output.writeBoolNoTag(deleted_.getBoolean(i));
        com.google.protobuf.GeneratedMessageV3.writeString(output, 1, deleted_.getRaw(i));
      }
      unknownFields.writeTo(output);
    }
@@ -3524,14 +3522,11 @@ public final class Automation {
      size = 0;
      {
        int dataSize = 0;
        dataSize = 1 * getDeletedList().size();
        size += dataSize;
        if (!getDeletedList().isEmpty()) {
          size += 1;
          size += com.google.protobuf.CodedOutputStream
              .computeInt32SizeNoTag(dataSize);
        for (int i = 0; i < deleted_.size(); i++) {
          dataSize += computeStringSizeNoTag(deleted_.getRaw(i));
        }
        deletedMemoizedSerializedSize = dataSize;
        size += dataSize;
        size += 1 * getDeletedList().size();
      }
      size += unknownFields.getSerializedSize();
      memoizedSize = size;
@@ -3698,7 +3693,7 @@ public final class Automation {
      @java.lang.Override
      public Builder clear() {
        super.clear();
        deleted_ = emptyBooleanList();
        deleted_ = com.google.protobuf.LazyStringArrayList.EMPTY;
        bitField0_ = (bitField0_ & ~0x00000001);
        return this;
      }
@@ -3728,7 +3723,7 @@ public final class Automation {
        automation.Automation.DeviceDeletionResult result = new automation.Automation.DeviceDeletionResult(this);
        int from_bitField0_ = bitField0_;
        if (((bitField0_ & 0x00000001) != 0)) {
          deleted_.makeImmutable();
          deleted_ = deleted_.getUnmodifiableView();
          bitField0_ = (bitField0_ & ~0x00000001);
        }
        result.deleted_ = deleted_;
@@ -3820,68 +3815,83 @@ public final class Automation {
      }
      private int bitField0_;

      private com.google.protobuf.Internal.BooleanList deleted_ = emptyBooleanList();
      private com.google.protobuf.LazyStringList deleted_ = com.google.protobuf.LazyStringArrayList.EMPTY;
      private void ensureDeletedIsMutable() {
        if (!((bitField0_ & 0x00000001) != 0)) {
          deleted_ = mutableCopy(deleted_);
          deleted_ = new com.google.protobuf.LazyStringArrayList(deleted_);
          bitField0_ |= 0x00000001;
         }
      }
      /**
       * <code>repeated bool deleted = 1;</code>
       * <code>repeated string deleted = 1;</code>
       * @return A list containing the deleted.
       */
      public java.util.List<java.lang.Boolean>
      public com.google.protobuf.ProtocolStringList
          getDeletedList() {
        return ((bitField0_ & 0x00000001) != 0) ?
                 java.util.Collections.unmodifiableList(deleted_) : deleted_;
        return deleted_.getUnmodifiableView();
      }
      /**
       * <code>repeated bool deleted = 1;</code>
       * <code>repeated string deleted = 1;</code>
       * @return The count of deleted.
       */
      public int getDeletedCount() {
        return deleted_.size();
      }
      /**
       * <code>repeated bool deleted = 1;</code>
       * <code>repeated string deleted = 1;</code>
       * @param index The index of the element to return.
       * @return The deleted at the given index.
       */
      public boolean getDeleted(int index) {
        return deleted_.getBoolean(index);
      public java.lang.String getDeleted(int index) {
        return deleted_.get(index);
      }
      /**
       * <code>repeated bool deleted = 1;</code>
       * <code>repeated string deleted = 1;</code>
       * @param index The index of the value to return.
       * @return The bytes of the deleted at the given index.
       */
      public com.google.protobuf.ByteString
          getDeletedBytes(int index) {
        return deleted_.getByteString(index);
      }
      /**
       * <code>repeated string deleted = 1;</code>
       * @param index The index to set the value at.
       * @param value The deleted to set.
       * @return This builder for chaining.
       */
      public Builder setDeleted(
          int index, boolean value) {
          int index, java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  ensureDeletedIsMutable();
        deleted_.setBoolean(index, value);
        deleted_.set(index, value);
        onChanged();
        return this;
      }
      /**
       * <code>repeated bool deleted = 1;</code>
       * <code>repeated string deleted = 1;</code>
       * @param value The deleted to add.
       * @return This builder for chaining.
       */
      public Builder addDeleted(boolean value) {
      public Builder addDeleted(
          java.lang.String value) {
        if (value == null) {
    throw new NullPointerException();
  }
  ensureDeletedIsMutable();
        deleted_.addBoolean(value);
        deleted_.add(value);
        onChanged();
        return this;
      }
      /**
       * <code>repeated bool deleted = 1;</code>
       * <code>repeated string deleted = 1;</code>
       * @param values The deleted to add.
       * @return This builder for chaining.
       */
      public Builder addAllDeleted(
          java.lang.Iterable<? extends java.lang.Boolean> values) {
          java.lang.Iterable<java.lang.String> values) {
        ensureDeletedIsMutable();
        com.google.protobuf.AbstractMessageLite.Builder.addAll(
            values, deleted_);
@@ -3889,15 +3899,31 @@ public final class Automation {
        return this;
      }
      /**
       * <code>repeated bool deleted = 1;</code>
       * <code>repeated string deleted = 1;</code>
       * @return This builder for chaining.
       */
      public Builder clearDeleted() {
        deleted_ = emptyBooleanList();
        deleted_ = com.google.protobuf.LazyStringArrayList.EMPTY;
        bitField0_ = (bitField0_ & ~0x00000001);
        onChanged();
        return this;
      }
      /**
       * <code>repeated string deleted = 1;</code>
       * @param value The bytes of the deleted to add.
       * @return This builder for chaining.
       */
      public Builder addDeletedBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
    throw new NullPointerException();
  }
  checkByteStringIsUtf8(value);
        ensureDeletedIsMutable();
        deleted_.add(value);
        onChanged();
        return this;
      }
      @java.lang.Override
      public final Builder setUnknownFields(
          final com.google.protobuf.UnknownFieldSet unknownFields) {
@@ -4419,7 +4445,7 @@ public final class Automation {
      "evRoleId\030\001 \001(\0132\030.automation.DeviceRoleId" +
      "\0220\n\014devRoleState\030\002 \001(\0162\032.automation.ZtpD" +
      "eviceState\"\'\n\024DeviceDeletionResult\022\017\n\007de" +
      "leted\030\001 \003(\010\"\007\n\005Empty*H\n\016DeviceRoleType\022\010" +
      "leted\030\001 \003(\t\"\007\n\005Empty*H\n\016DeviceRoleType\022\010" +
      "\n\004NONE\020\000\022\013\n\007DEV_OPS\020\001\022\014\n\010DEV_CONF\020\002\022\021\n\rP" +
      "IPELINE_CONF\020\003*~\n\016ZtpDeviceState\022\033\n\027ZTP_" +
      "DEV_STATE_UNDEFINED\020\000\022\031\n\025ZTP_DEV_STATE_C" +
+6 −6
Original line number Diff line number Diff line
@@ -12,12 +12,12 @@ metadata:
  name: automationservice
spec:
  ports:
    - name: grpc-server
      port: 9999
      targetPort: 9999
    - name: http
      port: 8080
      targetPort: 8080
    - name: grpc-server
      port: 9999
      targetPort: 9999
  selector:
    app.kubernetes.io/name: automationservice
    app.kubernetes.io/version: 0.0.1
@@ -74,12 +74,12 @@ spec:
            timeoutSeconds: 10
          name: automationservice
          ports:
            - containerPort: 9999
              name: grpc-server
              protocol: TCP
            - containerPort: 8080
              name: http
              protocol: TCP
            - containerPort: 9999
              name: grpc-server
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet: