Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Onboarding MDE for Linux to LISA #3113

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Azure
  • Loading branch information
Zeeshan Akhter committed Dec 9, 2023
commit 61b0bbcacbf7571ac15323af31e3ba78bb7cd86c
20 changes: 19 additions & 1 deletion lisa/sut_orchestrator/azure/tools.py
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
# Licensed under the MIT license.

import re
import sys
import json
from pathlib import PurePath
from typing import Any, Dict, List, Optional, Tuple, Type
@@ -21,6 +22,8 @@
get_matched_str,
)
from lisa.util.process import ExecutableResult
from typing import Optional, cast
from lisa.operating_system import Posix


class Waagent(Tool):
@@ -566,18 +569,33 @@ def get_pool_records(self, pool_id: int, force_run: bool = False) -> Dict[str, s
class mdatp(Tool):
@property
def command(self) -> str:
self._log.info(f"Inside the func: [{sys._getframe().f_code.co_name}]")
return "mdatp"

@property
def can_install(self) -> bool:
return False
self._log.info(f"Inside the func: [{sys._getframe().f_code.co_name}]")
return True

def _install(self) -> bool:
self._log.info(f"Inside the func: [{sys._getframe().f_code.co_name}]")
posix_os: Posix = cast(Posix, self.node.os)
posix_os.add_azure_core_repo()
if posix_os.is_package_in_repo(self.command):
posix_os.install_packages(self.command)
self._log.info(f"{self.command} is installed successfully")
else:
raise UnsupportedDistroException(
node.os, f"The distro doesn't have {package} in its repo")
return self._check_exists()

def get_result(
self,
arg: str,
json_out: bool = False,
sudo: bool = False,
) -> None:
self._log.info(f"Inside the func: [{sys._getframe().f_code.co_name}]")
if json_out:
arg += ' --output json'
result = self.run(
18 changes: 18 additions & 0 deletions microsoft/testsuites/vm_extensions/mde.py
Original file line number Diff line number Diff line change
@@ -46,6 +46,24 @@ class MDE(TestSuite):
),
)
def verify_health(self, node: Node, log: Logger, result: TestResult) -> None:

environment = result.environment
assert environment, "fail to get environment from testresult"
platform = environment.platform
log.info(platform)
#assert isinstance(platform, AzurePlatform)
#rm_client = platform._rm_client
#assert rm_client
#msi_client = get_managed_service_identity_client(platform)

node_context = get_node_context(node)
resource_group_name = node_context.resource_group_name
location = node_context.location
vm_name = node_context.vm_name

# Add resource tag for AzSecPack
tag = {"exemptPolicy": True}
add_tag_for_vm(platform, resource_group_name, vm_name, tag, log)
output = node.tools[mdatp].get_result('health', json_out=True)

log.info(output)